An opinionated config manager.
Use like:
import * as config from '@numbereight/config';
const env = config.get({
// My convict Schema
MY_VAR: {
doc: 'This is the var of mine',
format: String,
env: 'MY_VAR',
sensitive: false,
// Use config.required to not have a default
default: config.required as string
}
});
Config supports the following indirections. When a variable's value begins with:
-
b64:
, the content of the variable is replaced with the base64-decoded value of the remainder of the variable. -
b64-file:
, the content of the variable is replaced with a filepath to a temporary file that contains the base64-decoded value of the remainder of the variable. -
filepath:
, the content of the variable is replaced with the content of the given filepath.