Skip to content

Settings: Builtin mapping from environment variables #386

Description

@jayvdb

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-settingsProject: actix-settingsC-featureCategory: new functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions