Explain how config inherits (#17)

This commit is contained in:
Eric Eastwood 2022-06-09 21:37:07 -05:00 committed by GitHub
parent 9fc71a3412
commit 952a3acd4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
// This file is based off the Gitter config, https://gitlab.com/gitlab-org/gitter/env/blob/master/lib/config.js // This file is based off the Gitter config,
// https://gitlab.com/gitlab-org/gitter/env/blob/master/lib/config.js
const path = require('path'); const path = require('path');
const nconf = require('nconf'); const nconf = require('nconf');
@ -23,6 +24,10 @@ const nodeEnv = configureNodeEnv();
console.log(`Config is using nodeEnv=${nodeEnv}`); console.log(`Config is using nodeEnv=${nodeEnv}`);
const configDir = path.join(__dirname, '../../config'); const configDir = path.join(__dirname, '../../config');
// Setup nconf to use (in-order):
// 1. Command-line arguments (argv)
// 2. Environment variables (env)
// 3. `config/config-{env}.json` files
nconf.argv().env('__'); nconf.argv().env('__');
nconf.add('envUser', { nconf.add('envUser', {