Skip to content

Commit 7b3cc13

Browse files
committed
fix: [710] make secrets in config options mandatory
- `tracker.token` - `auth.user_claim_token_pepper` It keeps the default for the SMPT server credential ebcuase they are not always needed. - `mail.smpt.credentials.password`
1 parent 4d85120 commit 7b3cc13

9 files changed

+63
-5
lines changed

share/default/config/index.container.mysql.toml

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ threshold = "info"
1111
#threshold = "debug"
1212
#threshold = "trace"
1313

14+
[tracker]
15+
token = "MyAccessToken"
16+
17+
[auth]
18+
user_claim_token_pepper = "MaxVerstappenWC2021"
19+
1420
[database]
1521
connect_url = "mysql://root:root_secret_password@mysql:3306/torrust_index"
1622

share/default/config/index.container.sqlite3.toml

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ threshold = "info"
1111
#threshold = "debug"
1212
#threshold = "trace"
1313

14+
[tracker]
15+
token = "MyAccessToken"
16+
17+
[auth]
18+
user_claim_token_pepper = "MaxVerstappenWC2021"
19+
1420
[database]
1521
connect_url = "sqlite:///var/lib/torrust/index/database/sqlite3.db?mode=rwc"
1622

share/default/config/index.development.sqlite3.toml

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ threshold = "info"
1111
#threshold = "debug"
1212
#threshold = "trace"
1313

14+
[tracker]
15+
token = "MyAccessToken"
16+
17+
[auth]
18+
user_claim_token_pepper = "MaxVerstappenWC2021"
19+
1420
# Uncomment if you want to enable TSL for development
1521
#[net.tsl]
1622
#ssl_cert_path = "./storage/index/lib/tls/localhost.crt"

share/default/config/index.private.e2e.container.sqlite3.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ threshold = "info"
1515
api_url = "http://tracker:1212"
1616
listed = false
1717
private = true
18+
token = "MyAccessToken"
1819
url = "http://tracker:7070"
1920

21+
[auth]
22+
user_claim_token_pepper = "MaxVerstappenWC2021"
23+
2024
[database]
2125
connect_url = "sqlite:///var/lib/torrust/index/database/e2e_testing_sqlite3.db?mode=rwc"
2226

@@ -25,4 +29,4 @@ port = 1025
2529
server = "mailcatcher"
2630

2731
[registration]
28-
[registration.email]
32+
[registration.email]

share/default/config/index.public.e2e.container.mysql.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ threshold = "info"
1313

1414
[tracker]
1515
api_url = "http://tracker:1212"
16+
token = "MyAccessToken"
1617
url = "udp://tracker:6969"
1718

19+
[auth]
20+
user_claim_token_pepper = "MaxVerstappenWC2021"
21+
1822
[database]
1923
connect_url = "mysql://root:root_secret_password@mysql:3306/torrust_index_e2e_testing"
2024

@@ -23,4 +27,4 @@ port = 1025
2327
server = "mailcatcher"
2428

2529
[registration]
26-
[registration.email]
30+
[registration.email]

share/default/config/index.public.e2e.container.sqlite3.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ threshold = "info"
1313

1414
[tracker]
1515
api_url = "http://tracker:1212"
16+
token = "MyAccessToken"
1617
url = "udp://tracker:6969"
1718

19+
[auth]
20+
user_claim_token_pepper = "MaxVerstappenWC2021"
21+
1822
[database]
1923
connect_url = "sqlite:///var/lib/torrust/index/database/e2e_testing_sqlite3.db?mode=rwc"
2024

@@ -23,4 +27,4 @@ port = 1025
2327
server = "mailcatcher"
2428

2529
[registration]
26-
[registration.email]
30+
[registration.email]

share/default/config/tracker.private.e2e.container.sqlite3.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ schema_version = "2.0.0"
44
[logging]
55
threshold = "info"
66

7+
[tracker]
8+
token = "MyAccessToken"
9+
10+
[auth]
11+
user_claim_token_pepper = "MaxVerstappenWC2021"
12+
713
[core]
814
listed = false
915
private = true
@@ -17,4 +23,3 @@ bind_address = "0.0.0.0:6969"
1723

1824
[http_api]
1925
bind_address = "0.0.0.0:1212"
20-

share/default/config/tracker.public.e2e.container.sqlite3.toml

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ schema_version = "2.0.0"
44
[logging]
55
threshold = "info"
66

7+
[tracker]
8+
token = "MyAccessToken"
9+
10+
[auth]
11+
user_claim_token_pepper = "MaxVerstappenWC2021"
12+
713
[core]
814
listed = false
915
private = false

src/config/mod.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,12 @@ impl Configuration {
340340
/// Will return an error if a mandatory configuration option is only
341341
/// obtained by default value (code), meaning the user hasn't overridden it.
342342
fn check_mandatory_options(figment: &Figment) -> Result<(), Error> {
343-
let mandatory_options = ["metadata.schema_version", "logging.threshold"];
343+
let mandatory_options = [
344+
"auth.user_claim_token_pepper",
345+
"logging.threshold",
346+
"metadata.schema_version",
347+
"tracker.token",
348+
];
344349

345350
for mandatory_option in mandatory_options {
346351
figment
@@ -512,6 +517,12 @@ mod tests {
512517
513518
[logging]
514519
threshold = "info"
520+
521+
[tracker]
522+
token = "MyAccessToken"
523+
524+
[auth]
525+
user_claim_token_pepper = "MaxVerstappenWC2021"
515526
"#,
516527
)?;
517528

@@ -537,6 +548,12 @@ mod tests {
537548
538549
[logging]
539550
threshold = "info"
551+
552+
[tracker]
553+
token = "MyAccessToken"
554+
555+
[auth]
556+
user_claim_token_pepper = "MaxVerstappenWC2021"
540557
"#
541558
.to_string();
542559

0 commit comments

Comments
 (0)