pub struct EnvVarConfig { /* private fields */ }Expand description
Configuration provider that reads from environment variables.
This is the default configuration provider for WiseGate CLI. All values are cached at creation time using the global lazy statics.
Implements all composable configuration traits:
RateLimitingProviderfor rate limiting settingsProxyProviderfor proxy behaviorFilteringProviderfor request filteringConnectionProviderfor connection limits
§Example
use wisegate::config::EnvVarConfig;
use wisegate_core::RateLimitingProvider;
let config = EnvVarConfig::new();
println!("Max requests: {}", config.rate_limit_config().max_requests);Implementations§
Source§impl EnvVarConfig
impl EnvVarConfig
Trait Implementations§
Source§impl AuthenticationProvider for EnvVarConfig
impl AuthenticationProvider for EnvVarConfig
Source§fn auth_credentials(&self) -> &Credentials
fn auth_credentials(&self) -> &Credentials
Returns the list of authentication credentials for Basic Auth.
Source§fn auth_realm(&self) -> &str
fn auth_realm(&self) -> &str
Returns the realm for WWW-Authenticate header.
Source§fn bearer_token(&self) -> Option<&str>
fn bearer_token(&self) -> Option<&str>
Returns the bearer token, if configured.
Whether to forward the
Authorization header to the upstream service. Read moreSource§fn is_basic_auth_enabled(&self) -> bool
fn is_basic_auth_enabled(&self) -> bool
Returns true if Basic Auth is enabled (credentials configured).
Source§fn is_bearer_auth_enabled(&self) -> bool
fn is_bearer_auth_enabled(&self) -> bool
Returns true if Bearer Token auth is enabled.
Source§fn is_auth_enabled(&self) -> bool
fn is_auth_enabled(&self) -> bool
Returns true if any authentication is enabled.
Source§impl Clone for EnvVarConfig
impl Clone for EnvVarConfig
Source§fn clone(&self) -> EnvVarConfig
fn clone(&self) -> EnvVarConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConnectionProvider for EnvVarConfig
impl ConnectionProvider for EnvVarConfig
Source§fn max_connections(&self) -> usize
fn max_connections(&self) -> usize
Returns the maximum number of concurrent connections.
Source§impl Debug for EnvVarConfig
impl Debug for EnvVarConfig
Source§impl Default for EnvVarConfig
impl Default for EnvVarConfig
Source§impl FilteringProvider for EnvVarConfig
impl FilteringProvider for EnvVarConfig
Source§fn blocked_ips(&self) -> &[String]
fn blocked_ips(&self) -> &[String]
Returns the list of blocked IP addresses.
Source§fn blocked_methods(&self) -> &[String]
fn blocked_methods(&self) -> &[String]
Returns the list of blocked HTTP methods.
Source§fn blocked_patterns(&self) -> &[String]
fn blocked_patterns(&self) -> &[String]
Returns the list of blocked URL patterns.
Source§impl ProxyProvider for EnvVarConfig
impl ProxyProvider for EnvVarConfig
Source§fn proxy_config(&self) -> &ProxyConfig
fn proxy_config(&self) -> &ProxyConfig
Returns the proxy configuration.
Source§fn allowed_proxy_ips(&self) -> Option<&[String]>
fn allowed_proxy_ips(&self) -> Option<&[String]>
Returns the list of allowed proxy IPs, if configured.
When
Some, strict mode is enabled. When None, permissive mode is used.Source§impl RateLimitingProvider for EnvVarConfig
impl RateLimitingProvider for EnvVarConfig
Source§fn rate_limit_config(&self) -> &RateLimitConfig
fn rate_limit_config(&self) -> &RateLimitConfig
Returns the rate limiting configuration.
Source§fn rate_limit_cleanup_config(&self) -> &RateLimitCleanupConfig
fn rate_limit_cleanup_config(&self) -> &RateLimitCleanupConfig
Returns the rate limiter cleanup configuration.
Auto Trait Implementations§
impl Freeze for EnvVarConfig
impl RefUnwindSafe for EnvVarConfig
impl Send for EnvVarConfig
impl Sync for EnvVarConfig
impl Unpin for EnvVarConfig
impl UnsafeUnpin for EnvVarConfig
impl UnwindSafe for EnvVarConfig
Blanket Implementations§
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