Skip to content
Snippets Groups Projects
Commit 68b8c84c authored by Rudolf Copi Eckelberg's avatar Rudolf Copi Eckelberg
Browse files

Added test_config.json

parent 95a94867
No related branches found
No related tags found
2 merge requests!116Release v1.0.0,!25Auth
......@@ -20,3 +20,4 @@ build/*
config.json
docs/
test_config.json
......@@ -48,6 +48,8 @@ gulp.task('compile', () => {
// copy configuration file to build directory
gulp.src('config.json')
.pipe(gulp.dest('build'));
gulp.src('test_config.json')
.pipe(gulp.dest('build'));
});
gulp.task('build', ['compile']);
......
......@@ -10,6 +10,7 @@ const libs = `${process.cwd()}/libs`;
const log = require(`${libs}/log`)(module);
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
const config = require(`${libs}/config`);
const cache = require('apicache').options({ debug: config.get('debug') }).middleware;
......@@ -22,7 +23,6 @@ const mongoose = require(`${libs}/db/mongoose`);
const db = mongoose();
// Set default node environment
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
// Parse json received in requests
app.use(bodyParser.json());
......
const nconf = require('nconf');
let config_file;
switch(process.env.NODE_ENV) {
case 'development':
config_file = 'config.json';
break;
case 'test':
config_file = 'test_config.json';
break;
case 'production':
config_file = 'config.json';
break;
}
// Exports the config.json as an object with get functions
nconf.argv()
.env()
.file({ file: `${process.cwd()}/config.json` });
.file({ file: `${process.cwd()}/${config_file}` });
console.log(nconf.get('mongodb'));
module.exports = nconf;
process.env.NODE_ENV = 'test';
const chai = require('chai');
const dirtyChai = require('dirty-chai');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment