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

feat(config): allow multi word env var keys #617

Merged
merged 5 commits into from
Mar 2, 2023

Conversation

lfleischmann
Copy link
Member

@lfleischmann lfleischmann commented Mar 1, 2023

Description

Fixes #126

Implementation

  • Use envconfig to load environment variables instead of koanf
    • Use split_words struct tag to correctly load vars where config keys consist of multiple words

Tests

Added a (very) small unit test to see whether a config option is correctly overwritten by what is specified through the env var and that multivalued env vars are read correctly. To test for yourself, join config keys by _
(underscore), uppercase the keys, i.e. for server.public.cors.allow_methods
use:

export SERVER_PUBLIC_CORS_ALLOW_METHODS="GET,PUT,POST,DELETE"

Start the backend and observe whether your changes are correct.

@lfleischmann lfleischmann marked this pull request as ready for review March 1, 2023 13:37
@like-a-bause
Copy link
Collaborator

fixes #126

@lfleischmann lfleischmann merged commit 2460fdc into main Mar 2, 2023
@lfleischmann lfleischmann deleted the feat-allow-multi-word-env-var-keys branch March 2, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Backend configuration through environment variables not possible for multi-word, underline delimited keys
2 participants