Skip to content

Commit

Permalink
Merge #592: Configuration overhaul: migrate to Figment crate
Browse files Browse the repository at this point in the history
66de695 test: show error when test env is not running (Jose Celano)
757751f fix: [#581] broken tests using relative paths for fixtures (Jose Celano)
6ea859b chore(deps): [#581] remove unused dep config (Jose Celano)
018dfc3 refactor: [#581] migration to Figment (Jose Celano)
ccb2fef chore(deps): add cargo dep figment (Jose Celano)
8d3c8cb refactor: [#581] move semantic validation (Jose Celano)
790e1ec refactor: [#581] rename TorrustIndex to Settings (Jose Celano)
1a28309 refactor: [#581] remove unused code (Jose Celano)
07a3fb6 reafctor: reaname TorrustIndex to Settings (Jose Celano)

Pull request description:

  Configuration overhaul: migrate to Figment crate.

  ### Subtasks

  - [x] Rename `TorrustIndex` to `Settings`.
  - [x] Remove more unused code.
  - [x] Move semantic validation to `Settings`.
  - [x] Add `figment` crate.
  - [x] Use Figment to load the configuration from the toml file.
  - [x] Remove `config` crate.
  - [ ] ~~Move config env var constants like `ENV_VAR_CONFIG` from `src/bootstrap` to `src/config`~~ (I will do it in a new PR).

  ### In a new PR

  Use Figment convention for env vars to override tracker API token and auth secret. After this PR is merged, both options will be available (old and new names). We can remove the old ones after replacing all the old env vars in this repo and the Index GUI.

  Rename env vars:

  ```
  TORRUST_INDEX_CONFIG             -> TORRUST_INDEX_CONFIG_TOML
  TORRUST_INDEX_PATH_CONFIG        -> TORRUST_INDEX_CONFIG_TOML_PATH
  TORRUST_INDEX_TRACKER_API_TOKEN  -> TORRUST_INDEX_CONFIG_OVERRIDE_TRACKER__TOKEN
  TORRUST_INDEX_AUTH_SECRET_KEY    -> TORRUST_INDEX_CONFIG_OVERRIDE_AUTH__SECRET_KEY
  ```

Top commit has no ACKs.

Tree-SHA512: 67aac6bbb9ce2c1fd08b7ae32ce8b56c7121f97e638d5762ceec2ecf2dd11d8f70049d56f964a996f4e8bb185f4327579e2ddc374f5d3c0e54779248ea8ca122
  • Loading branch information
josecelano committed May 21, 2024
2 parents c9b1d5a + 66de695 commit f34c998
Show file tree
Hide file tree
Showing 16 changed files with 445 additions and 306 deletions.
223 changes: 81 additions & 142 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ bytes = "1"
camino = { version = "1.1.6", features = ["serde"] }
chrono = { version = "0", default-features = false, features = ["clock"] }
clap = { version = "4.5.4", features = ["derive", "env"] }
config = "0"
derive_more = "0"
email_address = "0"
fern = "0"
figment = { version = "0.10", features = ["env", "test", "toml"] }
futures = "0"
futures-util = "0.3.30"
hex = "0"
Expand Down
Loading

0 comments on commit f34c998

Please sign in to comment.