Skip to content
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
41 changes: 1 addition & 40 deletions share/default/config/index.container.mysql.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,9 @@

log_level = "info"

[website]
name = "Torrust"

[tracker]
url = "udp://tracker:6969"
mode = "Public"
api_url = "http://tracker:1212"
token = "MyAccessToken"
token_valid_seconds = 7257600

[net]
port = 3001

[auth]
email_on_signup = "Optional"
min_password_length = 6
max_password_length = 64
secret_key = "MaxVerstappenWC2021"

[database]
connect_url = "mysql://root:root_secret_password@mysql:3306/torrust_index"

[mail]
email_verification_enabled = false
from = "[email protected]"
reply_to = "[email protected]"
username = ""
password = ""
server = "mailcatcher"
port = 1025

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000

[api]
default_torrent_page_size = 10
max_torrent_page_size = 30

[tracker_statistics_importer]
torrent_info_update_interval = 3600
port = 3002
server = "mailcatcher"
49 changes: 5 additions & 44 deletions share/default/config/index.container.sqlite3.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,12 @@
log_level = "info"

[website]
name = "Torrust"

# Please override the tracker token setting the
# `TORRUST_INDEX_CONFIG_OVERRIDE_TRACKER__TOKEN`
# environmental variable!
# Please override the following settings with environmental variable!
# tracker::token -> `TORRUST_INDEX_CONFIG_OVERRIDE_TRACKER__TOKEN`
# auth::secret_key -> `TORRUST_INDEX_CONFIG_OVERRIDE_AUTH__SECRET_KEY`

[tracker]
url = "udp://tracker:6969"
mode = "Public"
api_url = "http://tracker:1212"
token = "MyAccessToken"
token_valid_seconds = 7257600

[net]
port = 3001

[auth]
email_on_signup = "Optional"
min_password_length = 6
max_password_length = 64
secret_key = "MaxVerstappenWC2021"
log_level = "info"

[database]
connect_url = "sqlite:///var/lib/torrust/index/database/sqlite3.db?mode=rwc"

[mail]
email_verification_enabled = false
from = "[email protected]"
reply_to = "[email protected]"
username = ""
password = ""
server = "mailcatcher"
port = 1025

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000

[api]
default_torrent_page_size = 10
max_torrent_page_size = 30

[tracker_statistics_importer]
torrent_info_update_interval = 3600
port = 3002
server = "mailcatcher"
50 changes: 4 additions & 46 deletions share/default/config/index.development.sqlite3.toml
Original file line number Diff line number Diff line change
@@ -1,52 +1,10 @@
log_level = "info"

[website]
name = "Torrust"

[tracker]
api_url = "http://localhost:1212/"
mode = "Public"
token = "MyAccessToken"
token_valid_seconds = 7257600
url = "udp://localhost:6969"
# Please override the following settings with environmental variable!
# tracker::token -> `TORRUST_INDEX_CONFIG_OVERRIDE_TRACKER__TOKEN`
# auth::secret_key -> `TORRUST_INDEX_CONFIG_OVERRIDE_AUTH__SECRET_KEY`

[net]
port = 3001
log_level = "info"

# Uncomment if you want to enable TSL for development
#[net.tsl]
#ssl_cert_path = "./storage/index/lib/tls/localhost.crt"
#ssl_key_path = "./storage/index/lib/tls/localhost.key"

[auth]
email_on_signup = "Optional"
max_password_length = 64
min_password_length = 6
secret_key = "MaxVerstappenWC2021"

[database]
connect_url = "sqlite://data.db?mode=rwc"

[mail]
email_verification_enabled = false
from = "[email protected]"
password = ""
port = 25
reply_to = "[email protected]"
server = ""
username = ""

[image_cache]
capacity = 128000000
entry_size_limit = 4000000
max_request_timeout_ms = 1000
user_quota_bytes = 64000000
user_quota_period_seconds = 3600

[api]
default_torrent_page_size = 10
max_torrent_page_size = 30

[tracker_statistics_importer]
port = 3002
torrent_info_update_interval = 3600
39 changes: 2 additions & 37 deletions share/default/config/index.e2e.container.mysql.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,13 @@

log_level = "info"

[website]
name = "Torrust"

[tracker]
url = "udp://tracker:6969"
mode = "Public"
api_url = "http://tracker:1212"
token = "MyAccessToken"
token_valid_seconds = 7257600

[net]
port = 3001

[auth]
email_on_signup = "Optional"
min_password_length = 6
max_password_length = 64
secret_key = "MaxVerstappenWC2021"
url = "udp://tracker:6969"

[database]
connect_url = "mysql://root:root_secret_password@mysql:3306/torrust_index_e2e_testing"

[mail]
email_verification_enabled = false
from = "[email protected]"
reply_to = "[email protected]"
username = ""
password = ""
server = "mailcatcher"
port = 1025

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000

[api]
default_torrent_page_size = 10
max_torrent_page_size = 30

[tracker_statistics_importer]
torrent_info_update_interval = 3600
port = 3002
server = "mailcatcher"
39 changes: 2 additions & 37 deletions share/default/config/index.e2e.container.sqlite3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,13 @@

log_level = "info"

[website]
name = "Torrust"

[tracker]
url = "udp://tracker:6969"
mode = "Public"
api_url = "http://tracker:1212"
token = "MyAccessToken"
token_valid_seconds = 7257600

[net]
port = 3001

[auth]
email_on_signup = "Optional"
min_password_length = 6
max_password_length = 64
secret_key = "MaxVerstappenWC2021"
url = "udp://tracker:6969"

[database]
connect_url = "sqlite:///var/lib/torrust/index/database/e2e_testing_sqlite3.db?mode=rwc"

[mail]
email_verification_enabled = false
from = "[email protected]"
reply_to = "[email protected]"
username = ""
password = ""
server = "mailcatcher"
port = 1025

[image_cache]
max_request_timeout_ms = 1000
capacity = 128000000
entry_size_limit = 4000000
user_quota_period_seconds = 3600
user_quota_bytes = 64000000

[api]
default_torrent_page_size = 10
max_torrent_page_size = 30

[tracker_statistics_importer]
torrent_info_update_interval = 3600
port = 3002
server = "mailcatcher"
16 changes: 14 additions & 2 deletions src/config/v1/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,28 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Api {
/// The default page size for torrent lists.
#[serde(default = "Api::default_default_torrent_page_size")]
pub default_torrent_page_size: u8,
/// The maximum page size for torrent lists.
#[serde(default = "Api::default_max_torrent_page_size")]
pub max_torrent_page_size: u8,
}

impl Default for Api {
fn default() -> Self {
Self {
default_torrent_page_size: 10,
max_torrent_page_size: 30,
default_torrent_page_size: Api::default_default_torrent_page_size(),
max_torrent_page_size: Api::default_max_torrent_page_size(),
}
}
}

impl Api {
fn default_default_torrent_page_size() -> u8 {
10
}

fn default_max_torrent_page_size() -> u8 {
30
}
}
22 changes: 19 additions & 3 deletions src/config/v1/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Auth {
/// Whether or not to require an email on signup.
#[serde(default = "EmailOnSignup::default")]
pub email_on_signup: EmailOnSignup,
/// The minimum password length.
#[serde(default = "Auth::default_min_password_length")]
pub min_password_length: usize,
/// The maximum password length.
#[serde(default = "Auth::default_max_password_length")]
pub max_password_length: usize,
/// The secret key used to sign JWT tokens.
#[serde(default = "Auth::default_secret_key")]
pub secret_key: SecretKey,
}

impl Default for Auth {
fn default() -> Self {
Self {
email_on_signup: EmailOnSignup::default(),
min_password_length: 6,
max_password_length: 64,
secret_key: SecretKey::new("MaxVerstappenWC2021"),
min_password_length: Self::default_min_password_length(),
max_password_length: Self::default_max_password_length(),
secret_key: Self::default_secret_key(),
}
}
}
Expand All @@ -30,6 +34,18 @@ impl Auth {
pub fn override_secret_key(&mut self, secret_key: &str) {
self.secret_key = SecretKey::new(secret_key);
}

fn default_min_password_length() -> usize {
6
}

fn default_max_password_length() -> usize {
64
}

fn default_secret_key() -> SecretKey {
SecretKey::new("MaxVerstappenWC2021")
}
}

/// Whether the email is required on signup or not.
Expand Down
9 changes: 8 additions & 1 deletion src/config/v1/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ pub struct Database {
///
/// Sqlite: `sqlite://data.db?mode=rwc`.
/// Mysql: `mysql://root:root_secret_password@mysql:3306/torrust_index_e2e_testing`.
#[serde(default = "Database::default_connect_url")]
pub connect_url: Url,
}

impl Default for Database {
fn default() -> Self {
Self {
connect_url: Url::parse("sqlite://data.db?mode=rwc").unwrap(),
connect_url: Self::default_connect_url(),
}
}
}

impl Database {
fn default_connect_url() -> Url {
Url::parse("sqlite://data.db?mode=rwc").unwrap()
}
}
Loading