#[non_exhaustive]pub enum EnvError {
#[non_exhaustive] BothSet {
var: String,
path: String,
},
#[non_exhaustive] ReadFailed {
var: String,
path: String,
source: Error,
},
#[non_exhaustive] NotAFile {
var: String,
path: String,
},
#[non_exhaustive] FileTooLarge {
var: String,
path: String,
},
#[non_exhaustive] EmptyFile {
var: String,
path: String,
},
#[non_exhaustive] NextWithoutCurrent {
var: String,
},
#[non_exhaustive] Several {
errors: Vec<EnvError>,
},
}env only.Expand description
A problem loading a secret from the environment.
Debug and Display never include a secret’s value — only variable
names and file paths, neither of which is secret itself.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]BothSet
var and <var>_FILE were both set. Ambiguous on purpose: silently
preferring one would hide the other from an operator who set both by
mistake.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ReadFailed
<var>_FILE named a file that could not be read.
Display names the variable and path only; the I/O failure is the
error’s source, not part of its text, so
a reporter that walks the source chain (anyhow, for one) prints the
cause once rather than twice. oauth_config_from_env appends it to
the problem text itself.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NotAFile
<var>_FILE names something other than a regular file — a directory,
a FIFO, a device such as /dev/zero — which is refused before it is
opened: reading one could block startup forever or never end.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]FileTooLarge
The file named by <var>_FILE is larger than
MAX_SECRET_FILE_BYTES (64 KiB). No secret or config value is
anywhere near that size; such a file is the wrong file. At most one
byte past the limit is read.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]EmptyFile
The file named by <var>_FILE was read successfully but was empty (or
all whitespace). Unlike a blank VAR, this is an error rather than
“unset”: a secrets-mount file that exists but is empty is far more
likely a provisioning mistake than an intentional absence.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NextWithoutCurrent
static_tokens_from_env: <var>_NEXT (or <var>_NEXT_FILE) is set
but <var> (and <var>_FILE) is not. A next key with no current one
is a half-done rotation — promote the next key into <var> — and is
refused rather than read as the only key.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Several
Several variables failed to load at once (from
static_tokens_from_env, the current and the next key both), so
every problem is reported in one run. Display joins theirs with
"; ".
Fields
This variant is marked as non-exhaustive
Trait Implementations§
Source§impl Error for EnvError
impl Error for EnvError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()