resolve
etl_craft.config.resolve ¶
Resolving settings: every value is a variable name or a value.
A setting whose text is a valid variable name, and that the secrets source defines, takes that
variable's value; anything else is used exactly as written. So Profile: dev is the profile
dev unless a variable named dev is set, and Profile: ETL_CRAFT_PROFILE is whatever
that variable holds. For a profile's own fields, a profile-specific variable wins over the plain
name: ENGINE_PROD_SECRET over ENGINE_SECRET for the prod profile.
Secrets are the exception. A secret field must name a variable, and that variable must be set: the file is meant to be committed, and falling back to the text would send a mistyped variable name to the server as a password.
Resolver
dataclass
¶
Resolves settings against one set of variables and records where each value came from.
origin names the source in error messages; path is the config file.
for_source
classmethod
¶
Build the resolver for everything after Secrets.
selected_name ¶
Return the profile-specific variable when it is set, else var_name.
resolve ¶
Return raw resolved: a set variable's value, else raw itself.
Lists resolve item by item; values YAML already typed (numbers, booleans) are returned as they are.
text ¶
text(raw: Any, where: str, *, profile: str | None = None, field_name: str | None = None) -> str | None
Resolve a setting that must be a non-empty string; None when it is absent.
secret_name ¶
Return the variable a secret field names, or None when the field is absent.
Raises ConfigurationError when the field is not a variable name, or names one that
is not set. Only the selected profile is parsed, so another environment's secrets need
not be present.
missing_hint ¶
Suggest similarly named variables without showing any of their values.
hint ¶
Explain a bad value that was used as written because no variable by its name is set.
read_secrets_file ¶
Read the .env file Secrets.Path names; ConfigurationError if it is unreadable.
source_values ¶
Return the variables the secrets source defines.
profile_variable_name ¶
Insert the profile before a field's suffix: ENGINE_SECRET becomes ENGINE_DEV_SECRET.
Returns None when var_name does not end with the field's name, and var_name
itself when it already carries the profile. from_address also matches _FROM.
resolve_secret ¶
Read profile's secret from the secrets source, as it is now.
Raises ConfigurationError if the variable is no longer set.
resolve_named_secret ¶
Resolve an additional connection secret without retaining it in the config.
profile_needs_secret ¶
Whether connecting with profile reads a secret.
profile_secret ¶
Return profile's secret, or "" when its auth mode presents none.
none, sts and sso without a client secret have nothing to present; a key file's
passphrase is read when the profile names one.