Outerfaces.Rev (Outerfaces Dependency Distribution (ODD) v0.2.5)
View SourceManages the current revision identifier for rev-pinned asset serving.
Rev sources (in priority order):
- OUTERFACES_REV environment variable (for production deployments)
- Git SHA via
git rev-parse HEAD(for dev/staging) - Application config :outerfaces_odd, :rev
- Timestamp fallback (for local dev without git)
The rev value is cached in :persistent_term for optimal read performance.
Summary
Functions
Returns the current revision identifier.
Invalidates the cached rev value, forcing a fresh fetch on next current_rev/0 call.
Rechecks and returns the current rev by invalidating the cache and fetching fresh.
Sets the revision to a specific value and caches it.
Functions
@spec current_rev() :: String.t()
Returns the current revision identifier.
The rev is cached in :persistent_term for performance. Once set, it persists
for the lifetime of the VM (or until explicitly invalidated).
Examples
iex> Outerfaces.Rev.current_rev()
"abc123def456"
@spec invalidate_cache() :: :ok
Invalidates the cached rev value, forcing a fresh fetch on next current_rev/0 call.
This is primarily useful for testing or when you need to update the rev at runtime by re-detecting from environment/git/config sources.
If you want to set a specific rev value, use set_rev/1 instead.
@spec recheck() :: String.t()
Rechecks and returns the current rev by invalidating the cache and fetching fresh.
This is a convenience method that combines invalidate_cache/0 and current_rev/0
to force a re-detection from environment/git/config sources in a single call.
Examples
iex> Outerfaces.Rev.recheck()
"abc123def456" # Freshly fetched from OUTERFACES_REV, git, config, or timestamp
@spec set_rev(String.t()) :: :ok
Sets the revision to a specific value and caches it.
This is useful when you want to manually update to a specific rev without relying on environment variables, git, or config.
Examples
iex> Outerfaces.Rev.set_rev("new-rev-123")
:ok
iex> Outerfaces.Rev.current_rev()
"new-rev-123"