[untested] searches root app dir for config.json
/config.json
/usergrid/config.json
/config/usergrid.json
diff --git a/helpers/config.js b/helpers/config.js
index 26c4fd2..63efdaa 100644
--- a/helpers/config.js
+++ b/helpers/config.js
@@ -1,7 +1,10 @@
'use strict'
var util = require('util'),
- _ = require('lodash')
+ path = require('path'),
+ file = require("file"),
+ _ = require('lodash'),
+ appRoot = path.dirname(require.main.filename)
if (/mocha$/i.test(process.argv[1])) {
var target = _(_.last(process.argv)).startsWith('--target=') ? _.last(process.argv).replace(/--target=/, '') : '1.0'
@@ -14,7 +17,15 @@
module.exports = config
} else {
try {
- module.exports = require('../config.json')
+ file.walkSync(appRoot, function(start, dirs, names) {
+ if (_.includes(dirs, "config") && _.includes(names, "usergrid.json")) {
+ module.exports = require(appRoot + '/config/usergrid.json')
+ } else if (_.includes(dirs, "usergrid") && _.includes(names, "config.json")) {
+ module.exports = require(appRoot + '/usergrid/config.json')
+ } else if (_.includes(names, "config.json")) {
+ module.exports = require(appRoot + '/config.json')
+ }
+ })
} catch (e) {
}
diff --git a/package.json b/package.json
index 4207d84..f930e1a 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,7 @@
"author": "Brandon Shelley",
"dependencies": {
"async": "latest",
+ "file": "latest",
"file-type": "^3.4.0",
"lodash": "~4.0",
"lodash-inflection": "latest",