pub struct Config {
pub server: ServerConfig,
pub logging: LoggingConfig,
pub admin: AdminConfig,
pub otel: OtelConfig,
pub cluster: HashMap<String, ClusterConfig>,
}Fields§
§server: ServerConfig§logging: LoggingConfig§admin: AdminConfig§otel: OtelConfig§cluster: HashMap<String, ClusterConfig>Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: &Path) -> Result<Self, ConfigError>
pub fn load(path: &Path) -> Result<Self, ConfigError>
Load and validate a config file.
Sourcepub fn parse(s: &str) -> Result<Self, ConfigError>
pub fn parse(s: &str) -> Result<Self, ConfigError>
Parse and validate a config from a TOML string.
Sourcepub fn find_pool(
&self,
database: &str,
) -> Option<(&str, &ClusterConfig, &PoolConfig)>
pub fn find_pool( &self, database: &str, ) -> Option<(&str, &ClusterConfig, &PoolConfig)>
Find the cluster name, cluster config, and pool config for a database.
Sourcepub fn is_user_allowed(&self, database: &str, user: &str) -> bool
pub fn is_user_allowed(&self, database: &str, user: &str) -> bool
Check whether a user is allowed to connect to the given database.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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