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

Use only non-defaults in toml config templates #858

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented May 13, 2024

After implementing the configuration with Figment, it's possible to omit values if they are defaults. Therefore, we don't need to add all options in templates. We only need to add values that overwrite the default values.

For example, the new configuration file for development environment (share/default/config/tracker.development.sqlite3.toml) is:

[[udp_trackers]]
enabled = true

[[http_trackers]]
enabled = true

The only difference with the default values is UDP and HTTP services are enabled.

This makes it easier to maintain these templates and to see what changes have been made compared to the default values.

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 96.59091% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 78.74%. Comparing base (3c78bba) to head (445bd53).

Files Patch % Lines
packages/configuration/src/v1/udp_tracker.rs 77.77% 2 Missing ⚠️
packages/configuration/src/v1/health_check_api.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #858      +/-   ##
===========================================
- Coverage    78.83%   78.74%   -0.10%     
===========================================
  Files          169      169              
  Lines         9341     9304      -37     
===========================================
- Hits          7364     7326      -38     
- Misses        1977     1978       +1     

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

@josecelano josecelano force-pushed the 856-config-overhaul-remove-default-values-from-config-file-templates branch from c6d3545 to a465158 Compare May 13, 2024 15:55
@josecelano josecelano force-pushed the 856-config-overhaul-remove-default-values-from-config-file-templates branch from a465158 to c91ba16 Compare May 13, 2024 16:07
After implementing the configuration with Figment, it's now possible to
omit values if they have a default value. Therefore we don't need to add
all options in templates. We only need to add values that are
overwriting deffault values.
@josecelano josecelano force-pushed the 856-config-overhaul-remove-default-values-from-config-file-templates branch from c91ba16 to 445bd53 Compare May 13, 2024 16:30
@josecelano
Copy link
Member Author

ACK 445bd53

@josecelano josecelano marked this pull request as ready for review May 13, 2024 17:12
@josecelano josecelano requested a review from da2ce7 May 13, 2024 17:12
@josecelano josecelano linked an issue May 13, 2024 that may be closed by this pull request
@josecelano josecelano added the Code Cleanup / Refactoring Tidying and Making Neat label May 13, 2024
@josecelano josecelano added this to the v3.0.0 milestone May 13, 2024
@josecelano josecelano merged commit d9909a6 into torrust:develop May 14, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup / Refactoring Tidying and Making Neat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config overhaul: remove default values from config file templates
1 participant