pub struct SecretConfig {
pub from: Option<String>,
pub command: Option<Vec<String>>,
pub ttl: Option<Duration>,
pub hosts: Vec<String>,
pub value: Option<String>,
}Expand description
A secret that the proxy injects into HTTP requests.
The value comes from exactly one source: a host environment variable
(from), a command that mints it (command), or a literal (value).
Fields§
§from: Option<String>Host environment variable to read the real value from.
command: Option<Vec<String>>Command to run to mint the value, as argv. Never passed to a shell. Re-run once the minted value approaches its expiry.
ttl: Option<Duration>Lifetime to assume when a command reports no expiry of its own.
hosts: Vec<String>Domain patterns where this secret may be sent (e.g., “api.openai.com”). The proxy only substitutes the placeholder on requests to these hosts.
value: Option<String>If set, use this value directly instead of reading from the host env var.
Implementations§
Source§impl SecretConfig
impl SecretConfig
Sourcepub fn from_env(var: impl Into<String>, hosts: Vec<String>) -> Self
pub fn from_env(var: impl Into<String>, hosts: Vec<String>) -> Self
Secret backed by a host environment variable.
Sourcepub fn from_command(command: Vec<String>, hosts: Vec<String>) -> Self
pub fn from_command(command: Vec<String>, hosts: Vec<String>) -> Self
Secret minted by running a command.
Sourcepub fn matches_domain(&self, domain: &str) -> bool
pub fn matches_domain(&self, domain: &str) -> bool
True if this secret is bound to domain.