Skip to content

Commit

Permalink
feat: [torrust#596] rename common E2E env vars
Browse files Browse the repository at this point in the history
We should not use specific names (sufix _E2E) for env vars that are not
specidif for E2E tests. These env vars are generic enva vars also used
in production. They only have different values for the E2E test env.

```
TORRUST_INDEX_E2E_CONFIG             -> TORRUST_INDEX_CONFIG
TORRUST_INDEX_E2E_TRACKER_API_TOKEN  -> TORRUST_INDEX_TRACKER_API_TOKEN
TORRUST_INDEX_E2E_AUTH_SECRET_KEY    -> TORRUST_INDEX_AUTH_SECRET_KEY
TORRUST_INDEX_E2E_PATH_CONFIG        -> TORRUST_INDEX_PATH_CONFIG
```
  • Loading branch information
josecelano committed May 22, 2024
1 parent 9290cbb commit fc1528d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contrib/dev-tools/container/e2e/mysql/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ docker ps

# Run E2E tests with shared app instance
TORRUST_INDEX_E2E_SHARED=true \
TORRUST_INDEX_E2E_PATH_CONFIG="./share/default/config/index.e2e.container.mysql.toml" \
TORRUST_INDEX_PATH_CONFIG="./share/default/config/index.e2e.container.mysql.toml" \
TORRUST_INDEX_E2E_DB_CONNECT_URL="mysql://root:root_secret_password@localhost:3306/torrust_index_e2e_testing" \
cargo test ||
{
Expand Down
2 changes: 1 addition & 1 deletion contrib/dev-tools/container/e2e/sqlite/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ docker ps

# Run E2E tests with shared app instance
TORRUST_INDEX_E2E_SHARED=true \
TORRUST_INDEX_E2E_PATH_CONFIG="./share/default/config/index.e2e.container.sqlite3.toml" \
TORRUST_INDEX_PATH_CONFIG="./share/default/config/index.e2e.container.sqlite3.toml" \
TORRUST_INDEX_E2E_DB_CONNECT_URL="sqlite://./storage/index/lib/database/e2e_testing_sqlite3.db?mode=rwc" \
cargo test ||
{
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ use torrust_index::config::{Configuration, Info};

/// The whole `index.toml` file content. It has priority over the config file.
/// Even if the file is not on the default path.
const ENV_VAR_CONFIG: &str = "TORRUST_INDEX_E2E_CONFIG";
const ENV_VAR_CONFIG: &str = "TORRUST_INDEX_CONFIG";

/// Token needed to communicate with the Torrust Tracker
const ENV_VAR_API_ADMIN_TOKEN: &str = "TORRUST_INDEX_E2E_TRACKER_API_TOKEN";
const ENV_VAR_API_ADMIN_TOKEN: &str = "TORRUST_INDEX_TRACKER_API_TOKEN";

/// Secret key used to encrypt and decrypt
const ENV_VAR_AUTH_SECRET_KEY: &str = "TORRUST_INDEX_E2E_AUTH_SECRET_KEY";
const ENV_VAR_AUTH_SECRET_KEY: &str = "TORRUST_INDEX_AUTH_SECRET_KEY";

/// The `index.toml` file location.
pub const ENV_VAR_PATH_CONFIG: &str = "TORRUST_INDEX_E2E_PATH_CONFIG";
pub const ENV_VAR_PATH_CONFIG: &str = "TORRUST_INDEX_PATH_CONFIG";

// Default values
pub const DEFAULT_PATH_CONFIG: &str = "./share/default/config/index.development.sqlite3.toml";
Expand All @@ -34,7 +34,7 @@ pub const ENV_VAR_DB_CONNECT_URL: &str = "TORRUST_INDEX_E2E_DB_CONNECT_URL";
/// There are two methods to inject the configuration:
///
/// 1. By using a config file: `index.toml`.
/// 2. Environment variable: `TORRUST_INDEX_E2E_CONFIG`. The variable contains the same contents as the `index.toml` file.
/// 2. Environment variable: `TORRUST_INDEX_CONFIG`. The variable contains the same contents as the `index.toml` file.
///
/// Environment variable has priority over the config file.
///
Expand Down

0 comments on commit fc1528d

Please sign in to comment.