Skip to content

Improved user-configurable constant handling#493

Merged
hoytak merged 1 commit intomainfrom
hoytak/250915-update-on-constant-parsing
Sep 16, 2025
Merged

Improved user-configurable constant handling#493
hoytak merged 1 commit intomainfrom
hoytak/250915-update-on-constant-parsing

Conversation

@hoytak
Copy link
Collaborator

@hoytak hoytak commented Sep 15, 2025

This PR adds in two upgrades to the current configurable_constants! macro that allows for users to specify the values of configuration constants using environment variables and the like. It adds two things:

  • Allows bool values to be parsed by 0, 1, true, false, on, off, etc. configurable_bool_constants! is no longer needed.
  • Allows Option to be a specified type with a default value of None, which parses the environment value as type T but puts it in Some(Value) if it's present and None if it's not specified. This allows us to determine if a value has been specified, e.g. in the case where the default depends on other things but can be overridden.

@hoytak hoytak merged commit 6cb0a7f into main Sep 16, 2025
6 checks passed
@hoytak hoytak deleted the hoytak/250915-update-on-constant-parsing branch September 16, 2025 19:43
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.

3 participants