diff --git a/.env.local b/.env.local index 8d5f8e89..faf5afb2 100644 --- a/.env.local +++ b/.env.local @@ -1,6 +1,7 @@ DATABASE_URL=sqlite://storage/database/data.db?mode=rwc -TORRUST_IDX_BACK_CONFIG= -TORRUST_IDX_BACK_USER_UID=1000 +TORRUST_INDEX_CONFIG= +USER_ID=1000 TORRUST_TRACKER_CONFIG= TORRUST_TRACKER_DATABASE_DRIVER=sqlite3 TORRUST_TRACKER_API_ADMIN_TOKEN=MyAccessToken + diff --git a/compose.yaml b/compose.yaml index 3ad56e74..fa968c41 100644 --- a/compose.yaml +++ b/compose.yaml @@ -67,7 +67,7 @@ services: environment: - MYSQL_ROOT_HOST=% - MYSQL_ROOT_PASSWORD=root_secret_password - - MYSQL_DATABASE=${TORRUST_IDX_BACK_MYSQL_DATABASE:-torrust_index_e2e_testing} + - MYSQL_DATABASE=${TORRUST_INDEX_MYSQL_DATABASE:-torrust_index_e2e_testing} - MYSQL_USER=db_user - MYSQL_PASSWORD=db_user_secret_password networks: diff --git a/contrib/dev-tools/container/build.sh b/contrib/dev-tools/container/build.sh index 21be00a3..e4dafebd 100755 --- a/contrib/dev-tools/container/build.sh +++ b/contrib/dev-tools/container/build.sh @@ -1,13 +1,13 @@ #!/bin/bash -TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} -TORRUST_IDX_BACK_RUN_AS_USER=${TORRUST_IDX_BACK_RUN_AS_USER:-appuser} +USER_ID=${USER_ID:-1000} +TORRUST_INDEX_RUN_AS_USER=${TORRUST_INDEX_RUN_AS_USER:-appuser} echo "Building docker image ..." -echo "TORRUST_IDX_BACK_USER_UID: $TORRUST_IDX_BACK_USER_UID" -echo "TORRUST_IDX_BACK_RUN_AS_USER: $TORRUST_IDX_BACK_RUN_AS_USER" +echo "USER_ID: $USER_ID" +echo "TORRUST_INDEX_RUN_AS_USER: $TORRUST_INDEX_RUN_AS_USER" docker build \ - --build-arg UID="$TORRUST_IDX_BACK_USER_UID" \ - --build-arg RUN_AS_USER="$TORRUST_IDX_BACK_RUN_AS_USER" \ + --build-arg UID="$USER_ID" \ + --build-arg RUN_AS_USER="$TORRUST_INDEX_RUN_AS_USER" \ -t torrust-index . diff --git a/contrib/dev-tools/container/e2e/mysql/e2e-env-up.sh b/contrib/dev-tools/container/e2e/mysql/e2e-env-up.sh index 73cd2fc6..e2af81f8 100755 --- a/contrib/dev-tools/container/e2e/mysql/e2e-env-up.sh +++ b/contrib/dev-tools/container/e2e/mysql/e2e-env-up.sh @@ -7,7 +7,7 @@ USER_ID=${USER_ID:-1000} \ TORRUST_INDEX_CONFIG=$(cat ./share/default/config/index.container.mysql.toml) \ TORRUST_INDEX_DATABASE_DRIVER="mysql" \ TORRUST_INDEX_TRACKER_API_TOKEN="MyAccessToken" \ - TORRUST_IDX_BACK_MYSQL_DATABASE="torrust_index_e2e_testing" \ + TORRUST_INDEX_MYSQL_DATABASE="torrust_index_e2e_testing" \ TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.container.sqlite3.toml) \ TORRUST_TRACKER_DATABASE_DRIVER="sqlite3" \ TORRUST_TRACKER_API_ADMIN_TOKEN="MyAccessToken" \ diff --git a/contrib/dev-tools/container/e2e/mysql/run-e2e-tests.sh b/contrib/dev-tools/container/e2e/mysql/run-e2e-tests.sh index a9e275d2..bee61a75 100755 --- a/contrib/dev-tools/container/e2e/mysql/run-e2e-tests.sh +++ b/contrib/dev-tools/container/e2e/mysql/run-e2e-tests.sh @@ -5,9 +5,9 @@ CURRENT_USER_ID=$(id -u) echo "User name: $CURRENT_USER_NAME" echo "User id: $CURRENT_USER_ID" -TORRUST_IDX_BACK_USER_UID=$CURRENT_USER_ID +USER_ID=$CURRENT_USER_ID TORRUST_TRACKER_USER_UID=$CURRENT_USER_ID -export TORRUST_IDX_BACK_USER_UID +export USER_ID export TORRUST_TRACKER_USER_UID # todo: remove duplicate funtion diff --git a/contrib/dev-tools/container/e2e/sqlite/run-e2e-tests.sh b/contrib/dev-tools/container/e2e/sqlite/run-e2e-tests.sh index 9506bc91..bfd6bbf1 100755 --- a/contrib/dev-tools/container/e2e/sqlite/run-e2e-tests.sh +++ b/contrib/dev-tools/container/e2e/sqlite/run-e2e-tests.sh @@ -5,9 +5,9 @@ CURRENT_USER_ID=$(id -u) echo "User name: $CURRENT_USER_NAME" echo "User id: $CURRENT_USER_ID" -TORRUST_IDX_BACK_USER_UID=$CURRENT_USER_ID +USER_ID=$CURRENT_USER_ID TORRUST_TRACKER_USER_UID=$CURRENT_USER_ID -export TORRUST_IDX_BACK_USER_UID +export USER_ID export TORRUST_TRACKER_USER_UID # todo: remove duplicate funtion diff --git a/contrib/dev-tools/container/run.sh b/contrib/dev-tools/container/run.sh index 19df5d3a..c967f788 100755 --- a/contrib/dev-tools/container/run.sh +++ b/contrib/dev-tools/container/run.sh @@ -1,11 +1,11 @@ #!/bin/bash -TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} -TORRUST_IDX_BACK_CONFIG=$(cat config.toml) +USER_ID=${USER_ID:-1000} +TORRUST_INDEX_CONFIG=$(cat config.toml) docker run -it \ - --user="$TORRUST_IDX_BACK_USER_UID" \ + --user="$USER_ID" \ --publish 3001:3001/tcp \ - --env TORRUST_IDX_BACK_CONFIG="$TORRUST_IDX_BACK_CONFIG" \ + --env TORRUST_INDEX_CONFIG="$TORRUST_INDEX_CONFIG" \ --volume "$(pwd)/storage":"/app/storage" \ torrust-index diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 49f661ac..e6910a33 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -20,7 +20,7 @@ pub const ENV_VAR_PATH_CONFIG: &str = "TORRUST_INDEX_PATH_CONFIG"; pub const DEFAULT_PATH_CONFIG: &str = "./share/default/config/index.development.sqlite3.toml"; /// If present, CORS will be permissive. -pub const ENV_VAR_CORS_PERMISSIVE: &str = "TORRUST_INDEX_BACK_CORS_PERMISSIVE"; +pub const ENV_VAR_CORS_PERMISSIVE: &str = "TORRUST_INDEX_API_CORS_PERMISSIVE"; /// It loads the application configuration from the environment. /// diff --git a/src/lib.rs b/src/lib.rs index 397dc04f..039bdfeb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,9 +110,9 @@ //! //! ```text //! mkdir -p ./storage/database \ -//! && export TORRUST_IDX_BACK_USER_UID=1000 \ +//! && export USER_ID=1000 \ //! && docker run -it \ -//! --user="$TORRUST_IDX_BACK_USER_UID" \ +//! --user="$USER_ID" \ //! --publish 3001:3001/tcp \ //! --volume "$(pwd)/storage":"/app/storage" \ //! torrust/index @@ -204,10 +204,10 @@ //! //! For more information about configuration you can visit the documentation for the [`config`]) module. //! -//! Alternatively to the `config.toml` file you can use one environment variable `TORRUST_IDX_BACK_CONFIG` to pass the configuration to the tracker: +//! Alternatively to the `config.toml` file you can use one environment variable `TORRUST_INDEX_CONFIG` to pass the configuration to the tracker: //! //! ```text -//! TORRUST_IDX_BACK_CONFIG=$(cat config.toml) +//! TORRUST_INDEX_CONFIG=$(cat config.toml) //! cargo run //! ``` //! @@ -215,9 +215,9 @@ //! //! The env var contains the same data as the `config.toml`. It's particularly useful in you are [running the index with docker](https://github.com/torrust/torrust-index/tree/develop/docker). //! -//! > **NOTICE**: The `TORRUST_IDX_BACK_CONFIG` env var has priority over the `config.toml` file. +//! > **NOTICE**: The `TORRUST_INDEX_CONFIG` env var has priority over the `config.toml` file. //! -//! > **NOTICE**: You can also change the location for the configuration file with the `TORRUST_IDX_BACK_CONFIG_PATH` env var. +//! > **NOTICE**: You can also change the location for the configuration file with the `TORRUST_INDEX_CONFIG_PATH` env var. //! //! # Usage //!