Crates.io | snyk-config |
lib.rs | snyk-config |
version | 0.2.0 |
source | src |
created_at | 2019-11-10 22:14:56.06156 |
updated_at | 2023-10-06 09:22:46.717751 |
description | Opinionated JSON config loader |
homepage | |
repository | https://github.com/FauxFaux/snyk-config-rs |
max_upload_size | |
id | 180111 |
size | 11,293 |
This is a port of @snyk/config,
an opinionated npm
library which loads config from files and
the environment.
It prefers:
CONF_
, as literals or JSON${CONFIG_SECRET_FILE}
config.${SERVICE_ENV}.json
config.default.json
The ${env_vars}
referenced above also have defaults:
CONFIG_SECRET_FILE
defaults to ./config.secret.json
SERVICE_ENV
defaults to local
Loaded values are merged, e.g.
config.default.json
:
{"buy": {"potatoes": 5}}
config.secret.json
:
{"buy": {"condamns": 1}}
env:
export CONF_buy__condamns=7
export CONF_debug=true
..will result in:
{"buy": {"condamns": 7, "potatoes": 5}, "debug": true}