-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (19 loc) · 719 Bytes
/
index.js
File metadata and controls
24 lines (19 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* Index.js
*
* @auther: harish <twitter:@harishanchu>
* Copyright (c) 2014, Harish Anchu. All rights reserved.
*/
var Config = require('./lib/config/Config');
var FileLoader = require('./lib/config/FileLoader');
var environmentDetector = require('./lib/config/environmentDetector');
var path = require('path');
var helper = require('./lib/support/helper');
module.exports = function (configDirPath, environments) {
if (!helper.isset(environments))
environments = {};
if (!helper.isset(configDirPath))
configDirPath = "";
var env = process.env.NODE_ENV = environmentDetector.detect(environments);
return new Config(new FileLoader(path.join(configDirPath, 'config')), env)
};