/** *****************************************************************************
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2018. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
 * Use, duplication or disclosure restricted by GSA ADP Schedule
 * Contract with IBM Corp.
 ****************************************************************************** */
/* Copyright (c) 2020 Red Hat, Inc. */
/* Copyright Contributors to the Open Cluster Management project */

const nconf = require('nconf');
const path = require('path');

const configDir = path.resolve(__dirname);

process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.NODE_ENV = process.env.BUILD_ENV || process.env.NODE_ENV;

nconf.argv().env('__');

const env = nconf.get('NODE_ENV');

nconf.file(env, `${configDir}/config-${env}.json`);
nconf.file('default', `${configDir}/config-defaults.json`);

module.exports = nconf;
