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

Settings: Builtin mapping from environment variables #386

Open
jayvdb opened this issue Jan 22, 2024 · 0 comments
Open

Settings: Builtin mapping from environment variables #386

jayvdb opened this issue Jan 22, 2024 · 0 comments
Labels
A-settings Project: actix-settings C-feature Category: new functionality

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jan 22, 2024

Expected Behavior

IMO actix-settings should have a default mechanism for overriding all settings from the environment. i.e. it should provide a consistent mapping of its settings to env-var names, so there is a function like 'apply_env(..)' which will read the env and override with any values found there.

Env vars are the more typical approach for overriding settings in a production service, e.g. in k8s. c.f. https://12factor.net/config and many others.

Some people prefer to use config files over envvars, but usually settings systems allow for both.

Current Behavior

The application needs to define all of their own env var names.

Possible Solution

IMO the names for the envvars could be prefixed with ACTIX_ and APPLICATION_ matching the toml, and then the rest of the name being the key in the toml with - -> _ .

Steps to Reproduce (for bugs)

Context

Your Environment

@jayvdb jayvdb changed the title Settings Settings: Builtin mapping from environment variables Jan 22, 2024
@robjtede robjtede added C-feature Category: new functionality A-settings Project: actix-settings labels Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-settings Project: actix-settings C-feature Category: new functionality
Projects
None yet
Development

No branches or pull requests

2 participants