actix / actix/actix-extras

Settings: Builtin mapping from environment variables

Aperta
#386 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
A-settings C-feature
Lingua principale
Rust
Stelle
889
Fork
224
Merge medio
9h 37m
PR unite (30g)
20

Descrizione

## 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.