All files configuration.js

100% Statements 7/7
75% Branches 6/8
100% Functions 0/0
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                  1x   1x       1x   1x 1x     1x        
////////////////
// note: do not import this file directly. The config should be passed around within
// the app. This allows the bridge to be run as a dependency in feathers-giveth
// This file should only be imported in files that call bridge(config);
///////////////
 
import fs from 'fs';
import path from 'path';
 
let { ENVIRONMENT, NODE_ENV } = process.env;
 
Eif (!ENVIRONMENT && NODE_ENV) ENVIRONMENT = NODE_ENV;
/* istanbul ignore next */
if (!ENVIRONMENT) ENVIRONMENT = 'local';
 
const config = JSON.parse(fs.readFileSync(path.join(__dirname, '../config/default.json')));
 
Eif (ENVIRONMENT && fs.existsSync(path.join(__dirname, `../config/${ENVIRONMENT}.json`))) {
    const localConfig = JSON.parse(
        fs.readFileSync(path.join(__dirname, `../config/${ENVIRONMENT}.json`)),
    );
    Object.assign(config, localConfig);
}
 
export default config;