Struct torrust_index_backend::config::Configuration
source · pub struct Configuration {
pub settings: RwLock<TorrustBackend>,
pub config_path: Option<String>,
}
Fields§
§settings: RwLock<TorrustBackend>
§config_path: Option<String>
Implementations§
source§impl Configuration
impl Configuration
sourcepub async fn load_from_file(
config_path: &str
) -> Result<Configuration, ConfigError>
pub async fn load_from_file( config_path: &str ) -> Result<Configuration, ConfigError>
Loads the configuration from the configuration file.
Errors
This function will return an error no configuration in the CONFIG_PATH
exists, and a new file is is created.
This function will return an error if the config
is not a valid TorrustConfig
document.
sourcepub fn load_from_env_var(
config_env_var_name: &str
) -> Result<Configuration, ConfigError>
pub fn load_from_env_var( config_env_var_name: &str ) -> Result<Configuration, ConfigError>
Loads the configuration from the environment variable. The whole configuration must be in the environment variable. It contains the same configuration as the configuration file with the same format.
Errors
Will return Err
if the environment variable does not exist or has a bad configuration.
sourcepub async fn save_to_file(&self, config_path: &str)
pub async fn save_to_file(&self, config_path: &str)
Returns the save to file of this Configuration
.
sourcepub async fn update_settings(
&self,
new_settings: TorrustBackend
) -> Result<(), ()>
pub async fn update_settings( &self, new_settings: TorrustBackend ) -> Result<(), ()>
pub async fn get_public(&self) -> ConfigurationPublic
Trait Implementations§
source§impl Debug for Configuration
impl Debug for Configuration
source§impl Default for Configuration
impl Default for Configuration
source§fn default() -> Configuration
fn default() -> Configuration
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl !UnwindSafe for Configuration
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