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`.
26 lines
475 B
JavaScript
26 lines
475 B
JavaScript
'use strict'
|
|
|
|
const sinon = require('sinon')
|
|
const serverSecrets = require('../../lib/server-secrets')
|
|
|
|
const user = 'admin'
|
|
const pass = 'password'
|
|
|
|
function mockJiraCreds() {
|
|
serverSecrets['jira_user'] = undefined
|
|
serverSecrets['jira_pass'] = undefined
|
|
sinon.stub(serverSecrets, 'jira_user').value(user)
|
|
sinon.stub(serverSecrets, 'jira_pass').value(pass)
|
|
}
|
|
|
|
function restore() {
|
|
sinon.restore()
|
|
}
|
|
|
|
module.exports = {
|
|
user,
|
|
pass,
|
|
mockJiraCreds,
|
|
restore,
|
|
}
|