Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config overhaul: define current config version as version 2 #940

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/configuration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Torrust Tracker, which is a `BitTorrent` tracker server.
//!
//! The current version for configuration is [`v1`].
pub mod v1;
pub mod v2;

use std::collections::HashMap;
use std::env;
Expand Down Expand Up @@ -34,12 +34,13 @@ const ENV_VAR_CONFIG_TOML: &str = "TORRUST_TRACKER_CONFIG_TOML";
/// The `tracker.toml` file location.
pub const ENV_VAR_CONFIG_TOML_PATH: &str = "TORRUST_TRACKER_CONFIG_TOML_PATH";

pub type Configuration = v1::Configuration;
pub type Core = v1::core::Core;
pub type HealthCheckApi = v1::health_check_api::HealthCheckApi;
pub type HttpApi = v1::tracker_api::HttpApi;
pub type HttpTracker = v1::http_tracker::HttpTracker;
pub type UdpTracker = v1::udp_tracker::UdpTracker;
pub type Configuration = v2::Configuration;
pub type Core = v2::core::Core;
pub type HealthCheckApi = v2::health_check_api::HealthCheckApi;
pub type HttpApi = v2::tracker_api::HttpApi;
pub type HttpTracker = v2::http_tracker::HttpTracker;
pub type UdpTracker = v2::udp_tracker::UdpTracker;
pub type Database = v2::database::Database;

pub type AccessTokens = HashMap<String, String>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};

use super::network::Network;
use crate::v1::database::Database;
use crate::v2::database::Database;
use crate::{AnnouncePolicy, TrackerPolicy};

#[allow(clippy::struct_excessive_bools)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ mod tests {

use std::net::{IpAddr, Ipv4Addr};

use crate::v1::Configuration;
use crate::v2::Configuration;
use crate::Info;

#[cfg(test)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl HttpApi {

#[cfg(test)]
mod tests {
use crate::v1::tracker_api::HttpApi;
use crate::v2::tracker_api::HttpApi;

#[test]
fn http_api_configuration_should_check_if_it_contains_a_token() {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/jobs/torrent_cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::sync::Arc;

use chrono::Utc;
use tokio::task::JoinHandle;
use torrust_tracker_configuration::v1::core::Core;
use torrust_tracker_configuration::Core;
use tracing::info;

use crate::core;
Expand Down
Loading