pub enum ConfigValue {
Inline(String),
Env(String),
}Expand description
A config value that is either inline or an env-var reference.
In TOML this deserializes from "literal" or { env = "VAR_NAME" } — the
same shape drizzle-kit and the CLI accept for dbCredentials.url. Used
anywhere a config value can be either inline or pulled from the
environment at runtime.
Variants§
Inline(String)
Value written inline in the config file.
Env(String)
Name of the environment variable to resolve.
Implementations§
Source§impl ConfigValue
impl ConfigValue
Sourcepub fn resolve(&self) -> Result<String, ConfigValueError>
pub fn resolve(&self) -> Result<String, ConfigValueError>
Resolve to a concrete string, reading the environment if needed.
§Errors
Returns ConfigValueError::NotPresent if this is a ConfigValue::Env pointing
to a variable that is not set, or ConfigValueError::NotUnicode if the
variable is set but contains invalid UTF-8.
Sourcepub fn resolve_optional(&self) -> Result<Option<String>, ConfigValueError>
pub fn resolve_optional(&self) -> Result<Option<String>, ConfigValueError>
Resolve to an optional value (returns None when an Env var is unset).
§Errors
Returns ConfigValueError::NotUnicode if the env var is set but contains
invalid UTF-8. Missing env vars resolve to Ok(None).