pub struct Config {
pub host: IpAddr,
pub port: u16,
pub api_key: Option<String>,
pub allowed_origins: Vec<String>,
pub allowed_hosts: Vec<String>,
pub databases: Vec<DatabaseConfig>,
pub limits: Limits,
pub toolsets: Toolsets,
pub audit_log: bool,
pub log_format: LogFormat,
}Fields§
§host: IpAddr§port: u16§api_key: Option<String>§allowed_origins: Vec<String>§allowed_hosts: Vec<String>§databases: Vec<DatabaseConfig>§limits: Limits§toolsets: Toolsets§audit_log: bool§log_format: LogFormatImplementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Config, ConfigError>
pub fn from_env() -> Result<Config, ConfigError>
Reads the process environment and validates it; see from_lookup.
Sourcepub fn prepare_tls(&mut self) -> Result<(), ConfigError>
pub fn prepare_tls(&mut self) -> Result<(), ConfigError>
Builds each database’s TLS configuration once, so the root file is read at startup, not per connection. A failure names the database and the cause, never the file contents.
Sourcepub fn from_lookup(
get: &dyn Fn(&str) -> Option<String>,
) -> Result<Config, ConfigError>
pub fn from_lookup( get: &dyn Fn(&str) -> Option<String>, ) -> Result<Config, ConfigError>
Same logic with an injectable variable lookup, for tests. An empty value counts as unset.
Sourcepub fn database(
&self,
name: Option<&str>,
) -> Result<&DatabaseConfig, ConfigError>
pub fn database( &self, name: Option<&str>, ) -> Result<&DatabaseConfig, ConfigError>
Returns the named database, or the only one when name is None.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Config
impl !UnwindSafe for Config
impl Forget for Config
impl Freeze for Config
impl Move for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more