pub(crate) struct Config {
pub(crate) port: u16,
pub(crate) accounts: Vec<StaticAccount>,
}Expand description
Define the properties of the external configuration.
Fields§
§port: u16Contain the port used for the server.
accounts: Vec<StaticAccount>Contain the accounts supported by the application.
Implementations§
Source§impl Config
impl Config
Sourcepub(crate) fn parse(config_path: &PathBuf) -> Result<Self, Box<dyn Error>>
pub(crate) fn parse(config_path: &PathBuf) -> Result<Self, Box<dyn Error>>
Parse configuration from multiple supported sources. We currently have support to read from an external TOML file and environment variables.
The precedence order, in which one source will override configuration from another source, is as follows (configuration in #1 will be overridden by configuration #2).
- External configuration file
- Environment variables
Accounts configuration is recommended to always be defined using an external configuration file as it can be difficult to provide the necessary structure using environment variables.
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
Source§impl Provider for Config
impl Provider for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin 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