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`.
24 lines
373 B
JavaScript
24 lines
373 B
JavaScript
'use strict'
|
|
|
|
const Server = require('./server')
|
|
const config = require('config').util.toObject()
|
|
|
|
function createTestServer({ port }) {
|
|
const serverConfig = {
|
|
...config,
|
|
public: {
|
|
...config.public,
|
|
bind: {
|
|
...config.public.bind,
|
|
port,
|
|
},
|
|
},
|
|
}
|
|
|
|
return new Server(serverConfig)
|
|
}
|
|
|
|
module.exports = {
|
|
createTestServer,
|
|
}
|