Skip to content

Commit

Permalink
refactor: [#576] rename tracker env vars
Browse files Browse the repository at this point in the history
```
TORRUST_TRACKER_BACK_           -> TORRUST_TRACKER_
TORRUST_TRACKER_DATABASE_DRIVER -> TORRUST_TRACKER_CONFIG_OVERRIDE_DB_DRIVER
TORRUST_TRACKER_API_ADMIN_TOKEN -> TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN
TORRUST_TRACKER_CONFIG          -> TORRUST_TRACKER_CONFIG_TOML
TORRUST_TRACKER_PATH_CONFIG     -> TORRUST_TRACKER_CONFIG_TOML_PATH
```

To follow changes in: torrust/torrust-tracker#851
  • Loading branch information
josecelano committed May 14, 2024
1 parent ce7de0a commit 470bfb2
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ DATABASE_URL=sqlite://storage/database/data.db?mode=rwc
TORRUST_INDEX_CONFIG=
TORRUST_INDEX_AUTH_SECRET_KEY=MaxVerstappenWC2021
USER_ID=1000
TORRUST_TRACKER_CONFIG=
TORRUST_TRACKER_DATABASE_DRIVER=sqlite3
TORRUST_TRACKER_API_ADMIN_TOKEN=MyAccessToken
TORRUST_TRACKER_CONFIG_TOML=
TORRUST_TRACKER_CONFIG_OVERRIDE_DB_DRIVER=Sqlite3
TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN=MyAccessToken
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ RUN ["/busybox/cp", "-sp", "/busybox/sh","/busybox/cat","/busybox/ls","/busybox/
COPY --from=gcc --chmod=0555 /usr/local/bin/su-exec /bin/su-exec

ARG TORRUST_INDEX_PATH_CONFIG="/etc/torrust/index/index.toml"
ARG TORRUST_INDEX_DATABASE_DRIVER="sqlite3"
ARG TORRUST_INDEX_DATABASE_DRIVER="Sqlite3"
ARG USER_ID=1000
ARG API_PORT=3001
ARG IMPORTER_API_PORT=3002
Expand Down
6 changes: 3 additions & 3 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ services:
tty: true
environment:
- USER_ID=${USER_ID}
- TORRUST_TRACKER_CONFIG=${TORRUST_TRACKER_CONFIG}
- TORRUST_TRACKER_CONFIG_TOML=${TORRUST_TRACKER_CONFIG_TOML}
- TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-e2e_testing_sqlite3}
- TORRUST_TRACKER_DATABASE_DRIVER=${TORRUST_TRACKER_DATABASE_DRIVER:-sqlite3}
- TORRUST_TRACKER_API_ADMIN_TOKEN=${TORRUST_TRACKER_API_ADMIN_TOKEN:-MyAccessToken}
- TORRUST_TRACKER_CONFIG_OVERRIDE_DB_DRIVER=${TORRUST_TRACKER_CONFIG_OVERRIDE_DB_DRIVER:-Sqlite3}
- TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN=${TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN:-MyAccessToken}
networks:
- server_side
ports:
Expand Down
2 changes: 1 addition & 1 deletion contrib/dev-tools/container/e2e/mysql/e2e-env-down.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

TORRUST_INDEX_CONFIG=$(cat ./share/default/config/index.e2e.container.mysql.toml) \
TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.e2e.container.sqlite.toml) \
TORRUST_TRACKER_CONFIG_TOML=$(cat ./share/default/config/tracker.e2e.container.sqlite.toml) \
docker compose down
6 changes: 3 additions & 3 deletions contrib/dev-tools/container/e2e/mysql/e2e-env-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ USER_ID=${USER_ID:-1000} \
TORRUST_INDEX_DATABASE_DRIVER="mysql" \
TORRUST_INDEX_TRACKER_API_TOKEN="MyAccessToken" \
TORRUST_INDEX_MYSQL_DATABASE="torrust_index_e2e_testing" \
TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
TORRUST_TRACKER_CONFIG_TOML=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
TORRUST_TRACKER_DATABASE="e2e_testing_sqlite3" \
TORRUST_TRACKER_DATABASE_DRIVER="sqlite3" \
TORRUST_TRACKER_API_ADMIN_TOKEN="MyAccessToken" \
TORRUST_TRACKER_CONFIG_OVERRIDE_DB_DRIVER="Sqlite3" \
TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN="MyAccessToken" \
docker compose up --detach --pull always --remove-orphans
2 changes: 1 addition & 1 deletion contrib/dev-tools/container/e2e/sqlite/e2e-env-down.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

TORRUST_INDEX_CONFIG=$(cat ./share/default/config/index.e2e.container.sqlite3.toml) \
TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
TORRUST_TRACKER_CONFIG_TOML=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
docker compose down
6 changes: 3 additions & 3 deletions contrib/dev-tools/container/e2e/sqlite/e2e-env-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ USER_ID=${USER_ID:-1000} \
TORRUST_INDEX_DATABASE_DRIVER="sqlite3" \
TORRUST_INDEX_TRACKER_API_TOKEN="MyAccessToken" \
TORRUST_INDEX_AUTH_SECRET_KEY="MaxVerstappenWC2021" \
TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
TORRUST_TRACKER_CONFIG_TOML=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
TORRUST_TRACKER_DATABASE="e2e_testing_sqlite3" \
TORRUST_TRACKER_DATABASE_DRIVER="sqlite3" \
TORRUST_TRACKER_API_ADMIN_TOKEN="MyAccessToken" \
TORRUST_TRACKER_CONFIG_OVERRIDE_DB_DRIVER="Sqlite3" \
TORRUST_TRACKER_CONFIG_OVERRIDE_HTTP_API__ACCESS_TOKENS__ADMIN="MyAccessToken" \
docker compose up --detach --pull always --remove-orphans
4 changes: 0 additions & 4 deletions share/default/config/tracker.container.mysql.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt"
ssl_enabled = false
ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key"

# Please override the admin token setting the
# `TORRUST_TRACKER_API_ADMIN_TOKEN`
# environmental variable!

[http_api.access_tokens]
admin = "MyAccessToken"

Expand Down
4 changes: 0 additions & 4 deletions share/default/config/tracker.container.sqlite3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt"
ssl_enabled = false
ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key"

# Please override the admin token setting the
# `TORRUST_TRACKER_API_ADMIN_TOKEN`
# environmental variable!

[http_api.access_tokens]
admin = "MyAccessToken"

Expand Down
5 changes: 0 additions & 5 deletions share/default/config/tracker.e2e.container.sqlite3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ ssl_cert_path = "/var/lib/torrust/tracker/tls/localhost.crt"
ssl_enabled = false
ssl_key_path = "/var/lib/torrust/tracker/tls/localhost.key"

# Please override the admin token setting the
# `TORRUST_TRACKER_API_ADMIN_TOKEN`
# environmental variable!

[http_api.access_tokens]
admin = "MyAccessToken"

[health_check_api]
bind_address = "127.0.0.1:1313"

2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Info {
pub enum Error {
/// Unable to load the configuration from the environment variable.
/// This error only occurs if there is no configuration file and the
/// `TORRUST_TRACKER_CONFIG` environment variable is not set.
/// `TORRUST_TRACKER_CONFIG_TOML` environment variable is not set.
#[error("Unable to load from Environmental Variable: {source}")]
UnableToLoadFromEnvironmentVariable {
source: LocatedError<'static, dyn std::error::Error + Send + Sync>,
Expand Down

0 comments on commit 470bfb2

Please sign in to comment.