Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 770fe25

Browse files
committed
fix: correct environment variable names and database config
- Fix environment variable names in compose.yaml: * TORRUST_TRACKER_CONFIG_OVERRIDE_CORE__DATABASE__PATH (was URL) * TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN - Change database config from 'url' to 'path' in tracker.toml.tpl - Add comprehensive TOML configuration example in template header - Replace JSON example with TOML format for consistency - Update documentation with proper Figment override patterns - All changes follow torrust-tracker-configuration conventions These changes ensure the tracker receives correct environment variable names following the Figment configuration override pattern with double underscores (__) separating nested sections.
1 parent 2d19b12 commit 770fe25

File tree

2 files changed

+97
-7
lines changed

2 files changed

+97
-7
lines changed

application/compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ services:
109109
restart: unless-stopped
110110
environment:
111111
- USER_ID=${USER_ID:-1000}
112-
# Database connection for tracker
113-
- TORRUST_TRACKER_DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
114-
# Admin API token for tracker
115-
- TORRUST_TRACKER_API_ADMIN_TOKEN=${TRACKER_ADMIN_TOKEN}
112+
# Database connection for tracker (using Figment override pattern)
113+
- TORRUST_TRACKER_CONFIG_OVERRIDE_CORE__DATABASE__PATH=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
114+
# Admin API token for tracker (using Figment override pattern)
115+
- TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN=${TRACKER_ADMIN_TOKEN}
116116
networks:
117117
- backend_network
118118
ports:

infrastructure/config/templates/tracker.toml.tpl

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
11
# Generated Torrust Tracker configuration for ${ENVIRONMENT}
22
# Generated on: ${GENERATION_DATE}
3+
#
4+
# Configuration Override with Environment Variables:
5+
# The Torrust Tracker uses the Figment crate for configuration management.
6+
# Any configuration value can be overridden using environment variables with the pattern:
7+
# TORRUST_TRACKER_CONFIG_OVERRIDE_<SECTION>__<SUBSECTION>__<KEY>
8+
#
9+
# Examples:
10+
# [core.database]
11+
# path = "..." -> TORRUST_TRACKER_CONFIG_OVERRIDE_CORE__DATABASE__PATH
12+
#
13+
# [http_api.access_tokens]
14+
# admin = "..." -> TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN
15+
#
16+
# [logging]
17+
# threshold = "..." -> TORRUST_TRACKER_CONFIG_OVERRIDE_LOGGING__THRESHOLD
18+
#
19+
# Rules:
20+
# - Use double underscores "__" to separate nested sections/keys
21+
# - Convert section names to UPPERCASE
22+
# - Dots in TOML become double underscores in env vars
23+
# - This follows Figment's environment variable override conventions
24+
#
25+
# Example TOML Configuration (output from tracker after merging all sources):
26+
# [metadata]
27+
# app = "torrust-tracker"
28+
# purpose = "configuration"
29+
# schema_version = "2.0.0"
30+
#
31+
# [logging]
32+
# threshold = "info"
33+
#
34+
# [core]
35+
# inactive_peer_cleanup_interval = 120
36+
# listed = false
37+
# private = false
38+
# tracker_usage_statistics = true
39+
#
40+
# [core.announce_policy]
41+
# interval = 120
42+
# interval_min = 120
43+
#
44+
# [core.database]
45+
# driver = "sqlite3"
46+
# path = "./storage/tracker/lib/database/sqlite3.db"
47+
#
48+
# [core.net]
49+
# external_ip = "0.0.0.0"
50+
# on_reverse_proxy = false
51+
#
52+
# [core.tracker_policy]
53+
# max_peer_timeout = 60
54+
# persistent_torrent_completed_stat = true
55+
# remove_peerless_torrents = true
56+
#
57+
# [[udp_trackers]]
58+
# bind_address = "0.0.0.0:6868"
59+
# tracker_usage_statistics = true
60+
#
61+
# [udp_trackers.cookie_lifetime]
62+
# secs = 120
63+
# nanos = 0
64+
#
65+
# [[udp_trackers]]
66+
# bind_address = "0.0.0.0:6969"
67+
# tracker_usage_statistics = true
68+
#
69+
# [udp_trackers.cookie_lifetime]
70+
# secs = 120
71+
# nanos = 0
72+
#
73+
# [[http_trackers]]
74+
# bind_address = "0.0.0.0:7070"
75+
# tracker_usage_statistics = true
76+
#
77+
# [[http_trackers]]
78+
# bind_address = "0.0.0.0:7171"
79+
# tracker_usage_statistics = true
80+
#
81+
# [http_api]
82+
# bind_address = "0.0.0.0:1212"
83+
#
84+
# [http_api.access_tokens]
85+
# admin = "***"
86+
#
87+
# [health_check_api]
88+
# bind_address = "127.0.0.1:1313"
89+
#
90+
# Documentation: https://docs.rs/torrust-tracker-configuration/latest/torrust_tracker_configuration/
391

492
[metadata]
593
app = "torrust-tracker"
@@ -21,8 +109,9 @@ interval_min = 120
21109

22110
[core.database]
23111
driver = "mysql"
24-
# URL will be set via environment variable: TORRUST_TRACKER_DATABASE_URL
25-
url = ""
112+
# Path will be overridden via environment variable:
113+
# TORRUST_TRACKER_CONFIG_OVERRIDE_CORE__DATABASE__PATH
114+
path = ""
26115

27116
[core.net]
28117
external_ip = "0.0.0.0"
@@ -41,7 +130,8 @@ bind_address = "127.0.0.1:1313"
41130
[http_api]
42131
bind_address = "0.0.0.0:1212"
43132

44-
# Admin token will be set via environment variable: TORRUST_TRACKER_API_ADMIN_TOKEN
133+
# Admin token will be overridden via environment variable:
134+
# TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN
45135
[http_api.access_tokens]
46136
# admin = ""
47137

0 commit comments

Comments
 (0)