pub struct EnvPlugin { /* private fields */ }Expand description
Layered environment configuration loader and HYPERLANE_* ServerConfig builder.
Implementations§
Source§impl EnvPlugin
Layered loading, typed extraction, and Hyperlane ServerConfig assembly for EnvPlugin.
impl EnvPlugin
Layered loading, typed extraction, and Hyperlane ServerConfig assembly for EnvPlugin.
Sourcepub fn from_process_env() -> Self
pub fn from_process_env() -> Self
Sourcepub fn from_dotenv_str(content: &str) -> Result<Self, EnvError>
pub fn from_dotenv_str(content: &str) -> Result<Self, EnvError>
Sourcepub fn with_prefix<S>(self, prefix: S) -> Self
pub fn with_prefix<S>(self, prefix: S) -> Self
Sets the automatic key prefix (for example DEFAULT_ENV_PREFIX "HYPERLANE_").
§Arguments
S- Prefix string.
§Returns
Self- Updated loader.
Sourcepub fn merge_dotenv_file(&mut self, path: &Path) -> Result<&mut Self, EnvError>
pub fn merge_dotenv_file(&mut self, path: &Path) -> Result<&mut Self, EnvError>
Sourcepub fn merge_process_env(&mut self) -> &mut Self
pub fn merge_process_env(&mut self) -> &mut Self
Merges OS process environment variables on top of existing entries.
§Returns
&mut Self- Mutable reference for chaining.
Sourcepub fn require_string(&self, key: &str) -> Result<String, EnvError>
pub fn require_string(&self, key: &str) -> Result<String, EnvError>
Reads a required string value or returns EnvError::Missing.
§Arguments
&str- Logical key name.
§Returns
Result<String, EnvError>- String value or missing error.
Sourcepub fn require_secret(&self, key: &str) -> Result<SecretValue, EnvError>
pub fn require_secret(&self, key: &str) -> Result<SecretValue, EnvError>
Reads a secret value wrapped in SecretValue.
§Arguments
&str- Logical key name.
§Returns
Result<SecretValue, EnvError>- Secret wrapper or missing error.
Sourcepub fn load_server_config(&self) -> Result<ServerConfig, EnvError>
pub fn load_server_config(&self) -> Result<ServerConfig, EnvError>
Builds a Hyperlane ServerConfig from ADDRESS/HOST+PORT, NODELAY, TTL, PROTOCOL, and TLS_CERT/TLS_KEY.
§Returns
Result<ServerConfig, EnvError>- PopulatedServerConfigor parse error.
Trait Implementations§
impl Eq for EnvPlugin
impl StructuralPartialEq for EnvPlugin
Auto Trait Implementations§
impl Forget for EnvPlugin
impl Freeze for EnvPlugin
impl Move for EnvPlugin
impl RefUnwindSafe for EnvPlugin
impl Send for EnvPlugin
impl Sync for EnvPlugin
impl Unpin for EnvPlugin
impl UnsafeUnpin for EnvPluginwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
impl UnwindSafe for EnvPlugin
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.