diff --git a/src/config/mod.rs b/src/config/mod.rs index f06b9498..81ca01ef 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -13,7 +13,7 @@ use tokio::sync::RwLock; use torrust_index_located_error::{Located, LocatedError}; use url::{ParseError, Url}; -pub type TorrustIndex = v1::Settings; +pub type Settings = v1::Settings; pub type Api = v1::api::Api; pub type Auth = v1::auth::Auth; pub type Database = v1::database::Database; @@ -225,13 +225,13 @@ impl Tsl { #[derive(Debug)] pub struct Configuration { /// The state of the configuration. - pub settings: RwLock, + pub settings: RwLock, } impl Default for Configuration { fn default() -> Configuration { Configuration { - settings: RwLock::new(TorrustIndex::default()), + settings: RwLock::new(Settings::default()), } } } @@ -252,7 +252,7 @@ impl Configuration { let config_builder = Config::builder() .add_source(File::from_str(&info.index_toml, FileFormat::Toml)) .build()?; - let mut index_config: TorrustIndex = config_builder.try_deserialize()?; + let mut index_config: Settings = config_builder.try_deserialize()?; if let Some(ref token) = info.tracker_api_token { index_config.override_tracker_api_token(token); @@ -267,7 +267,7 @@ impl Configuration { }) } - pub async fn get_all(&self) -> TorrustIndex { + pub async fn get_all(&self) -> Settings { let settings_lock = self.settings.read().await; settings_lock.clone() diff --git a/src/services/settings.rs b/src/services/settings.rs index 1693df73..a4b0e92e 100644 --- a/src/services/settings.rs +++ b/src/services/settings.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use super::user::DbUserRepository; -use crate::config::{Configuration, ConfigurationPublic, TorrustIndex}; +use crate::config::{Configuration, ConfigurationPublic, Settings}; use crate::errors::ServiceError; use crate::models::user::UserId; @@ -25,7 +25,7 @@ impl Service { /// # Errors /// /// It returns an error if the user does not have the required permissions. - pub async fn get_all(&self, user_id: &UserId) -> Result { + pub async fn get_all(&self, user_id: &UserId) -> Result { let user = self.user_repository.get_compact(user_id).await?; // Check if user is administrator @@ -44,7 +44,7 @@ impl Service { /// # Errors /// /// It returns an error if the user does not have the required permissions. - pub async fn get_all_masking_secrets(&self, user_id: &UserId) -> Result { + pub async fn get_all_masking_secrets(&self, user_id: &UserId) -> Result { let user = self.user_repository.get_compact(user_id).await?; // Check if user is administrator diff --git a/src/web/api/client/v1/contexts/settings/mod.rs b/src/web/api/client/v1/contexts/settings/mod.rs index e08a4103..e8f54759 100644 --- a/src/web/api/client/v1/contexts/settings/mod.rs +++ b/src/web/api/client/v1/contexts/settings/mod.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::config::{ Api as DomainApi, Auth as DomainAuth, Database as DomainDatabase, ImageCache as DomainImageCache, Mail as DomainMail, - Network as DomainNetwork, TorrustIndex as DomainSettings, Tracker as DomainTracker, + Network as DomainNetwork, Settings as DomainSettings, Tracker as DomainTracker, TrackerStatisticsImporter as DomainTrackerStatisticsImporter, Website as DomainWebsite, }; diff --git a/tests/common/contexts/settings/mod.rs b/tests/common/contexts/settings/mod.rs index ece13b6d..42e4771d 100644 --- a/tests/common/contexts/settings/mod.rs +++ b/tests/common/contexts/settings/mod.rs @@ -3,7 +3,7 @@ pub mod responses; use serde::{Deserialize, Serialize}; use torrust_index::config::{ Api as DomainApi, Auth as DomainAuth, Database as DomainDatabase, ImageCache as DomainImageCache, Mail as DomainMail, - Network as DomainNetwork, TorrustIndex as DomainSettings, Tracker as DomainTracker, + Network as DomainNetwork, Settings as DomainSettings, Tracker as DomainTracker, TrackerStatisticsImporter as DomainTrackerStatisticsImporter, Website as DomainWebsite, }; diff --git a/tests/environments/app_starter.rs b/tests/environments/app_starter.rs index 16e4306f..a981d524 100644 --- a/tests/environments/app_starter.rs +++ b/tests/environments/app_starter.rs @@ -9,7 +9,7 @@ use torrust_index::{app, config}; /// It launches the app and provides a way to stop it. pub struct AppStarter { - configuration: config::TorrustIndex, + configuration: config::Settings, /// The application binary state (started or not): /// - `None`: if the app is not started, /// - `RunningState`: if the app was started. @@ -18,7 +18,7 @@ pub struct AppStarter { impl AppStarter { #[must_use] - pub fn with_custom_configuration(configuration: config::TorrustIndex) -> Self { + pub fn with_custom_configuration(configuration: config::Settings) -> Self { Self { configuration, running_state: None, @@ -78,7 +78,7 @@ impl AppStarter { } #[must_use] - pub fn server_configuration(&self) -> config::TorrustIndex { + pub fn server_configuration(&self) -> config::Settings { self.configuration.clone() } diff --git a/tests/environments/isolated.rs b/tests/environments/isolated.rs index bcb2eba2..bb9dc24e 100644 --- a/tests/environments/isolated.rs +++ b/tests/environments/isolated.rs @@ -46,7 +46,7 @@ impl TestEnv { /// Provides the whole server configuration. #[must_use] - pub fn server_configuration(&self) -> config::TorrustIndex { + pub fn server_configuration(&self) -> config::Settings { self.app_starter.server_configuration() } @@ -69,10 +69,10 @@ impl Default for TestEnv { } /// Provides a configuration with ephemeral data for testing. -fn ephemeral(temp_dir: &TempDir) -> config::TorrustIndex { - let mut configuration = config::TorrustIndex { +fn ephemeral(temp_dir: &TempDir) -> config::Settings { + let mut configuration = config::Settings { log_level: Some("off".to_owned()), // Change to `debug` for tests debugging - ..config::TorrustIndex::default() + ..config::Settings::default() }; // Ephemeral API port