| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Config.Resolve
Description
Hierarchical configuration resolution (Viper-style). Unifies defaults, configuration files, and environment variables into a single resolution tree with strict precedence: Defaults < File < Env.
Synopsis
- deepMerge :: Value -> Value -> Value
- buildEnvAst :: [(String, String)] -> Value
- secretLeafKeys :: [Text]
- secretEnvSpellings :: [Text]
- envSpellingOf :: Text -> Text
- mountEnvKey :: Text -> Text -> Text
Documentation
deepMerge :: Value -> Value -> Value Source #
Right-biased deep merge of two Aeson Values. Objects are merged recursively. Other types (Arrays, Strings, etc.) are overwritten by the right side (the higher precedence value).
buildEnvAst :: [(String, String)] -> Value Source #
Convert a list of environment variables into a nested JSON Object.
Filters for keys starting with ECLUSE_ and strips the prefix.
Double underscores (__) represent nested object paths.
Single underscores (_) are converted to camelCase for Aeson key matching.
For example, ECLUSE_MOUNTSNPMPRIVATE_UPSTREAM becomes
{"mounts": {"npm": {"privateUpstream": ...}}}.
Values that parse as valid JSON (like numbers or booleans) are decoded;
otherwise they remain as Strings.
Two kinds of variable never enter the AST: anything outside the ECLUSE_
prefix (the ambient SDK environment, AWS_* included, is read directly at the
composition root; see Ecluse.Config.Ambient), and the reserved process-level
ECLUSE_CONFIG (the config-document path override, consumed by
Ecluse.Boot before the document is even read, so it must not double as a
document key).
secretLeafKeys :: [Text] Source #
The secret-typed leaf keys of the config schema, in their document spelling.
The one source for every site that treats a secret specially: the environment
layer (buildEnvAst takes their values verbatim), the provenance dump (these
leaves render redacted; Ecluse.Config), and the *_FILE indirection (their env
spellings are the only file-shaped side door; Ecluse.Boot).
secretEnvSpellings :: [Text] Source #
secretLeafKeys in their environment spelling (authToken -> AUTH_TOKEN).
envSpellingOf :: Text -> Text Source #
The environment spelling of a camelCase document key (authToken ->
AUTH_TOKEN): the inverse of the camelCase reconstruction buildEnvAst applies, so
the key a boot error tells an operator to set is exactly the key the resolver reads.
mountEnvKey :: Text -> Text -> Text Source #
The full environment key of a mount-scoped setting
(ECLUSE_MOUNTS{ECOSYSTEM}{KEY}), assembled from the mount's ecosystem name and
the setting's already env-spelled suffix. The one home shared by the config-load
errors (Ecluse.Config.Types) and the boot-error renderings
(Ecluse.Composition.BootError).