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

Initialize config structs with default values #1087

Closed
1 task done
Cyclonit opened this issue Mar 11, 2025 · 0 comments · Fixed by #1090
Closed
1 task done

Initialize config structs with default values #1087

Cyclonit opened this issue Mar 11, 2025 · 0 comments · Fixed by #1090
Assignees
Labels
feature/request New feature or request

Comments

@Cyclonit
Copy link
Contributor

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

Currently, all config structs contain Option<>. These options have some value if it was set in the configuration file or environment variables, and None otherwise. Default values are not taken into consideration at this point.

Whenever an option is used in the application code, the consumer must take care of unpacking the Option<> and substituting a default value if needed. If an option is used in multiple places, this unpacking needs to be repeated every time.

Desired solution

All options should be initialised with their respective default values when loading the config. This would have two benefits:

  1. All default values can be defined in one place.
  2. Handling of config options is simplied throughout the code.

Alternatives considered

none

Additional context

No response

@Cyclonit Cyclonit added the feature/request New feature or request label Mar 11, 2025
@Cyclonit Cyclonit changed the title initialize config structs with default values initialize config with default values Mar 12, 2025
@Cyclonit Cyclonit changed the title initialize config with default values initialize config structs with default values Mar 12, 2025
@orhun orhun assigned Cyclonit and unassigned orhun Mar 13, 2025
@orhun orhun changed the title initialize config structs with default values Initialize config structs with default values Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants