actix / actix/actix-extras

Settings: Builtin mapping from environment variables

Ouverte
#386 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
A-settings C-feature
Langage dominant
Rust
Étoiles
889
Forks
224
Merge moyen
9 h 37 min
PR mergées (30 j)
20

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.