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

Provide config defaults via config files #182

Merged
merged 6 commits into from
Jun 2, 2024

Conversation

spencewenski
Copy link
Member

Closes #180

Since we’re using the config crate, it probably makes more
sense (and would be cleaner) to provide the defaults via a
config file. In comparison, our [current approach](https://github.com/roadster-rs/roadster/blob/2aef4f0d25b87200370fe8f578b4c411117c3b6e/src/config/service/http/middleware.rs#L254)
of deserializing to an intermediate partial struct with customer
deserializers is pretty convoluted and requires a lot of
boilerplate.

The downside of this approach is we need to hard-code the default
middleware/initializer priorities in the config file vs setting them
dynamically. However, I think this is a decent trade off to get rid of
the boilerplate of our original approach. A test was added to check that
the priorities don't change by accident.
@spencewenski
Copy link
Member Author

There's technically a public API breaking change (hence the semver check failure). However, we don't have any dependencies yet, and the removed structs should have never been made in the first place, so we will release the changes in 0.2.x instead of 0.3.

Copy link

codecov bot commented Jun 2, 2024

Codecov Report

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

Project coverage is 45.62%. Comparing base (2aef4f0) to head (a570a81).

Files Coverage Δ
src/config/database/mod.rs 100.00% <ø> (ø)
src/config/service/http/default_routes.rs 100.00% <ø> (+0.91%) ⬆️
src/config/service/http/initializer.rs 100.00% <ø> (ø)
src/config/service/http/middleware.rs 100.00% <ø> (ø)
src/config/service/http/mod.rs 62.50% <100.00%> (+22.50%) ⬆️
src/config/service/worker/sidekiq/mod.rs 83.33% <100.00%> (-16.67%) ⬇️
src/config/tracing/mod.rs 100.00% <100.00%> (ø)
src/config/app_config.rs 34.61% <80.00%> (-13.87%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2aef4f0...a570a81. Read the comment docs.

@spencewenski spencewenski merged commit 9034c73 into main Jun 2, 2024
10 of 11 checks passed
@spencewenski spencewenski deleted the gh-180-default-config-file branch June 2, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide config defaults via a config file
1 participant