This implements the configuration mechanism I described in #2621. The heavy lifting is delegated to [node-config](https://github.com/lorenwest/node-config) with a minor assist from [dotenv](https://github.com/motdotla/dotenv). `private/secret.json` has been replaced with environment variables and/or `config/local.yml`. See `doc/server-secrets.md`.
16 lines
457 B
JavaScript
16 lines
457 B
JavaScript
'use strict'
|
|
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
const legacySecretsPath = path.join(__dirname, '..', 'private', 'secret.json')
|
|
if (fs.existsSync(legacySecretsPath)) {
|
|
console.error(
|
|
`Legacy secrets file found at ${legacySecretsPath}. It should be deleted and secrets replaced with environment variables or config/local.yml`
|
|
)
|
|
process.exit(1)
|
|
}
|
|
|
|
const config = require('config').util.toObject()
|
|
|
|
module.exports = config.private
|