const DOMAIN_NAME = 'localhost' const SERVER_PORT = process.env.PORT || 3000 module.exports = { domain: DOMAIN_NAME, app: { title: 'Enterprise Search', description: 'Enterprise Search', keywords: 'Enterprise Search, Independent' }, port: SERVER_PORT, logging: { . . . }, esui: { baseUrl: `http://${DOMAIN_NAME}:4200` }, security: { . . . }, mailer: { . . .}, analytics: { enable: true }, chat_forum: { enable: false, history_size: 100 }, // ElasticSearch connection for permissions, and other features elastic: { schema: 'http', host: 'localhost', port: 9200, indexName: 'esui' } }
The 3 environment configuration are just mirror images of the all.js, these configuration have specific values for different properties which will overwrite the ones in all.js. And as the name suggest each environment configuration contains different values for different environment, so far the Enterprise Search manages 3 environments local, development and production.
As mention before the config/server/config.js manages the merging of the all.js with the environment configuration.
To choose a configuration environment the enviroment variable NODE_ENV must be set, the server will look into this variable for the name of the configuration to use. By default if no environment is specified the one selected will be development.
You can set this variable depending on the console, like this:
For Local
$env:NODE_ENV="local"
set NODE_ENV="local"
export NODE_ENV="local"
For Development
$env:NODE_ENV="development"
set NODE_ENV="development"
export NODE_ENV="development"
For Production
$env:NODE_ENV="production"
set NODE_ENV="production"
export NODE_ENV="production"
This also means, more configuration enviroments can be added, as long as the nave in the environment variable matches with the configuration name, for examples if NODE_ENV value was test, then file name should be test.js