Skip to content

Commit

Permalink
refactor: [#581] remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed May 17, 2024
1 parent 07a3fb6 commit 1a28309
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,12 @@ impl Tsl {
pub struct Configuration {
/// The state of the configuration.
pub settings: RwLock<TorrustIndex>,
/// The path to the configuration file. This is `None` if the configuration
/// was loaded from the environment.
pub config_path: Option<String>,
}

impl Default for Configuration {
fn default() -> Configuration {
Configuration {
settings: RwLock::new(TorrustIndex::default()),
config_path: None,
}
}
}
Expand Down Expand Up @@ -268,7 +264,6 @@ impl Configuration {

Ok(Configuration {
settings: RwLock::new(index_config),
config_path: None,
})
}

Expand Down
5 changes: 1 addition & 4 deletions tests/environments/app_starter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use torrust_index::{app, config};
/// It launches the app and provides a way to stop it.
pub struct AppStarter {
configuration: config::TorrustIndex,
config_path: Option<String>,
/// The application binary state (started or not):
/// - `None`: if the app is not started,
/// - `RunningState`: if the app was started.
Expand All @@ -19,10 +18,9 @@ pub struct AppStarter {

impl AppStarter {
#[must_use]
pub fn with_custom_configuration(configuration: config::TorrustIndex, config_path: Option<String>) -> Self {
pub fn with_custom_configuration(configuration: config::TorrustIndex) -> Self {
Self {
configuration,
config_path,
running_state: None,
}
}
Expand All @@ -35,7 +33,6 @@ impl AppStarter {
pub async fn start(&mut self, api_version: Version) {
let configuration = Configuration {
settings: RwLock::new(self.configuration.clone()),
config_path: self.config_path.clone(),
};

// Open a channel to communicate back with this function
Expand Down
6 changes: 1 addition & 5 deletions tests/environments/isolated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ impl TestEnv {
let temp_dir = TempDir::new().expect("failed to create a temporary directory");

let configuration = ephemeral(&temp_dir);
// Even if we load the configuration from the environment variable, we
// still need to provide a path to save the configuration when the
// configuration is updated via the `POST /settings` endpoints.
let config_path = format!("{}/config.toml", temp_dir.path().to_string_lossy());

let app_starter = AppStarter::with_custom_configuration(configuration, Some(config_path));
let app_starter = AppStarter::with_custom_configuration(configuration);

Self { app_starter, temp_dir }
}
Expand Down

0 comments on commit 1a28309

Please sign in to comment.