Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracker Checker: pass configuration with env var #657

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Jan 29, 2024

Allows passing the configuration with an env var:

Run providing a config file path (option or env var):

cargo run --bin tracker_checker -- --config-path "./share/default/config/tracker_checker.json"

TORRUST_CHECKER_CONFIG_PATH="./share/default/config/tracker_checker.json" cargo run --bin tracker_checker

Run providing the configuration:

TORRUST_CHECKER_CONFIG=$(cat "./share/default/config/tracker_checker.json") cargo run --bin tracker_checker

This way we don't need to create a temp file in CI. See https://github.com/torrust/torrust-tracker/blob/develop/src/e2e/runner.rs#L71-L73

Subtasks

  • Use clap and anyhow.
  • Add env var TORRUST_TRACKER_CHECKER_CONFIG.
  • Use the new env var in the E2E runner binary.

@josecelano josecelano self-assigned this Jan 29, 2024
@josecelano josecelano added Testing Checking Torrust - Admin - Enjoyable to Install and Setup our Software labels Jan 29, 2024
@josecelano josecelano added this to the v3.0.0 milestone Jan 29, 2024
@josecelano josecelano linked an issue Jan 29, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

Attention: 30 lines in your changes are missing coverage. Please review.

Comparison is base (75a502f) 75.05% compared to head (392ffab) 74.81%.

Files Patch % Lines
src/checker/app.rs 0.00% 14 Missing ⚠️
src/e2e/tracker_checker.rs 0.00% 11 Missing ⚠️
src/e2e/runner.rs 0.00% 3 Missing ⚠️
src/checker/service.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #657      +/-   ##
===========================================
- Coverage    75.05%   74.81%   -0.24%     
===========================================
  Files          136      136              
  Lines         8902     8930      +28     
===========================================
  Hits          6681     6681              
- Misses        2221     2249      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano josecelano force-pushed the 656-tracker-checker-pass-configuration-with-env-var branch from 91f5c9f to 8543190 Compare January 30, 2024 07:15
We will need "env" clap feature to use env variables for arguments.
Run providing a config file path:

```text
cargo run --bin tracker_checker -- --config-path "./share/default/config/tracker_checker.json"
TORRUST_CHECKER_CONFIG_PATH="./share/default/config/tracker_checker.json" cargo run --bin tracker_checker
```

Run providing the configuration:

```text
TORRUST_CHECKER_CONFIG=$(cat "./share/default/config/tracker_checker.json") cargo run --bin tracker_checker
```
@josecelano josecelano force-pushed the 656-tracker-checker-pass-configuration-with-env-var branch from dab0025 to 1bab582 Compare January 30, 2024 08:52
… Checker

This was we don't even need a temp dir to run E2E tests.
@josecelano
Copy link
Member Author

ACK 392ffab

@josecelano josecelano marked this pull request as ready for review January 30, 2024 09:31
@josecelano josecelano merged commit 5b6cf7b into torrust:develop Jan 30, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Admin - Enjoyable to Install and Setup our Software Testing Checking Torrust
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Tracker Checker: pass configuration with env var
1 participant