pub struct AppConfig {
pub server: ServerConfig,
pub cache: CacheConfig,
pub logging: LoggingConfig,
pub rate_limiting: RateLimitConfig,
pub crates_io: CratesIoConfig,
}Expand description
Main application configuration
Fields§
§server: ServerConfigServer configuration
cache: CacheConfigCache configuration
logging: LoggingConfigLogging configuration
rate_limiting: RateLimitConfigRate limiting configuration
crates_io: CratesIoConfigCrates.io API configuration
Implementations§
Source§impl AppConfig
impl AppConfig
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Load configuration from file, environment, and defaults
Sourcepub fn load_from_file<P: AsRef<Path>>(
config_file: Option<P>,
) -> Result<Self, ConfigError>
pub fn load_from_file<P: AsRef<Path>>( config_file: Option<P>, ) -> Result<Self, ConfigError>
Load configuration from a specific file
Sourcepub fn create_sample_config() -> String
pub fn create_sample_config() -> String
Create a sample configuration file
Sourcepub fn bind_address(&self) -> String
pub fn bind_address(&self) -> String
Get the bind address for the server
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AppConfig
impl<'de> Deserialize<'de> for AppConfig
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 AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfig
impl Sync for AppConfig
impl Unpin for AppConfig
impl UnsafeUnpin for AppConfig
impl UnwindSafe for AppConfig
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