config.js 1.07 KB
const path = require('path');
const rootPath = path.normalize(__dirname + '/..');
const env = process.env.NODE_ENV || 'development';
const localConfig = require('./local');

// Please put all the default config in this boilerplate
const boilerplate = {
	root: rootPath,
	app: {
		name: 'advisoreat-backend'
	},
	port: process.env.PORT || 3000,
	database: localConfig.db,
};

boilerplate.siteUrl = `https://localhost:${boilerplate.port}`

const config = {
	development: {},
	test: {},
	staging: {},
	production: {}
};

/*** ATTENTION: Compose up your config objects! ***/
/**
 * Want to override your config? Do it!
 * E.g.
 * Object.assign(config.yourEnvironment, boilerplate, {
 *   mailgun: {
 *     apiKey: 'env-specific-api-key'
 *   }
 * });
 *
 * Will produce:
 *
 * {
 *   boilerplate.properties,
 *   mailgun: {
 *     apiKey: 'env-specific-key'
 *   }
 * }
 */

Object.assign(config.development, boilerplate, {});
Object.assign(config.test, boilerplate, {});
Object.assign(config.staging, boilerplate, {});
Object.assign(config.production, boilerplate, {});

module.exports = config[env];