Services.Globals (fnord v0.8.83)
View SourceDrop-in-ish replacement for Application env that shadows values down a process tree. Think: dynamic scope via process ancestry.
put_env/3sets an override in the current tree (installing the caller as a root if needed).get_env/3first checks the current tree's overrides, then falls back toApplication.get_env/3.delete_env/2removes the tree-local override.get_all_env/1lists all overrides in the current tree, overlaying them on top ofApplication.get_all_env/1if the caller is the root.put_all_env/2bulk-inserts multiple overrides for one or more apps in the current tree (installing the caller as a root if needed).install_root/0explicitly installs the caller as a shadowing root (rarely needed;put_env/3auto-installs).current_root/0returns the current shadowing root PID (or nil). Useful for debugging.explain/0prints the current process tree and its overrides (for debugging).
Summary
Functions
Returns a specification to start this module under a supervisor.
Return the current shadowing root PID (or nil). Useful for debugging.
Delete a tree-local override (no-op if none). Returns :ok.
Get all tree-local overrides for the given app, overlaying them on top of
Application.get_all_env/1 if the caller is the root.
Get a value with tree-local shadowing, else falls back to
Application.get_env/3.
Install the caller as a shadowing root explicitly (rarely needed; put_env/3 auto-installs).
Bulk put multiple overrides for one or more apps in the current tree (installing the caller as a root if needed).
Put a tree-local override. Creates a root for the current process if none exists.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec current_root() :: pid() | nil
Return the current shadowing root PID (or nil). Useful for debugging.
Delete a tree-local override (no-op if none). Returns :ok.
Get all tree-local overrides for the given app, overlaying them on top of
Application.get_all_env/1 if the caller is the root.
Get a value with tree-local shadowing, else falls back to
Application.get_env/3.
@spec install_root() :: :ok
Install the caller as a shadowing root explicitly (rarely needed; put_env/3 auto-installs).
Bulk put multiple overrides for one or more apps in the current tree (installing the caller as a root if needed).
Put a tree-local override. Creates a root for the current process if none exists.