From bb7f77a56e0dc6a9403858b24ae967d5cc67e818 Mon Sep 17 00:00:00 2001 From: Rudolf Copi Eckelberg <rce16@inf.ufpr.br> Date: Wed, 5 Oct 2016 10:40:50 -0300 Subject: [PATCH] Moved config files to config folder --- config.json.example => config/config.json.example | 0 .../test_config.json.example | 0 gulpfile.babel.js | 8 ++++---- src/libs/config.js | 9 ++++----- 4 files changed, 8 insertions(+), 9 deletions(-) rename config.json.example => config/config.json.example (100%) rename test_config.json.example => config/test_config.json.example (100%) diff --git a/config.json.example b/config/config.json.example similarity index 100% rename from config.json.example rename to config/config.json.example diff --git a/test_config.json.example b/config/test_config.json.example similarity index 100% rename from test_config.json.example rename to config/test_config.json.example diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 3a61dace..66bc5000 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -46,10 +46,10 @@ gulp.task('compile', () => { .pipe(gulp.dest('build')); // move compiled files to build directory // copy configuration file to build directory - gulp.src('config.json') - .pipe(gulp.dest('build')); - gulp.src('test_config.json') - .pipe(gulp.dest('build')); + gulp.src('config/config.json') + .pipe(gulp.dest('build/config')); + gulp.src('config/test_config.json') + .pipe(gulp.dest('build/config')); }); gulp.task('build', ['compile']); diff --git a/src/libs/config.js b/src/libs/config.js index dd2d88c4..d61eff99 100644 --- a/src/libs/config.js +++ b/src/libs/config.js @@ -1,16 +1,17 @@ const nconf = require('nconf'); +const CONFIG_DIR = `config` let config_file; switch(process.env.NODE_ENV) { case 'development': - config_file = 'config.json'; + config_file = `${CONFIG_DIR}/config.json`; break; case 'test': - config_file = 'test_config.json'; + config_file = `${CONFIG_DIR}/test_config.json`; break; case 'production': - config_file = 'config.json'; + config_file = `${CONFIG_DIR}/config.json`; break; } @@ -19,6 +20,4 @@ nconf.argv() .env() .file({ file: `${process.cwd()}/${config_file}` }); -console.log(nconf.get('mongodb')); - module.exports = nconf; -- GitLab