config-env
bsb/config-envEnvironment JSON configuration plugin for BSB profile and plugin resolution
config-env
config-env is the built-in configuration plugin for deployments that need the whole BSB runtime config supplied through environment.
It reads one JSON environment variable, selects a profile, and returns the same plugin definitions and plugin config objects as config-default.
What It Does
- Reads
BSB_CONFIG_JSON - Selects active profile using
BSB_PROFILE(default:default) - Resolves plugin definitions for:
serviceseventsobservable
- Returns each plugin's
configobject to that plugin at startup
Activation
BSB_CONFIG_PLUGIN=config-env
BSB_PROFILE=default
BSB_CONFIG_JSON='{"default":{"observable":{},"events":{},"services":{"service-api":{"plugin":"service-api","enabled":true,"config":{"port":3200}}}}}'
BSB_CONFIG_PLUGIN_PACKAGE is not needed when using the built-in BSB package.
JSON Shape
BSB_CONFIG_JSON uses the same profile shape as sec-config.yaml:
{
"default": {
"observable": {
"observable-default": {
"plugin": "observable-default",
"enabled": true,
"config": {}
}
},
"events": {
"events-default": {
"plugin": "events-default",
"enabled": true
}
},
"services": {
"service-my-api": {
"plugin": "service-my-api",
"package": "@org/my-api",
"enabled": true,
"config": {
"port": 3200
}
}
}
}
}
Environment Variables
BSB_CONFIG_PLUGIN: set toconfig-envBSB_PROFILE: active profile key in JSON (for exampledefault,production)BSB_CONFIG_JSON: full BSB runtime config JSON object
Notes
config-envdoes not parse flat env paths.config-envdoes not coerce env values into nested config fields.- Service, event, and observable plugin config still goes through each plugin's schema at startup.
- At least one service plugin must be enabled in the selected profile.
Installation
Install plugin (Node.js)
npm i @bsb/base
Configuration
Configuration for config plugins is provided through environment variables:
No configuration required
Available Versions
v9.6.59
v9.6.58
v9.6.57
v9.6.56
v9.6.55
v9.6.54
v9.6.53
v9.6.52
v9.6.51
v9.6.50
v9.6.49
v9.6.48
v9.6.47
v9.6.46
v9.6.45
v9.6.44
v9.6.43
v9.6.42
v9.6.41
v9.6.40
v9.6.39
v9.6.38
v9.6.37
v9.6.36
v9.6.35
v9.6.34
v9.6.33