a127-magic
Advanced tools
Comparing version 0.7.3 to 0.7.4
@@ -72,9 +72,5 @@ /**************************************************************************** | ||
appRoot = process.env.A127_APPROOT || path.dirname(require.main.filename); | ||
appRoot = findAppRoot(); | ||
configDir = path.resolve(appRoot, 'config'); | ||
if (!fs.existsSync(configDir)) { | ||
throw new Error('config directory doesn\'t exist: ' + configDir); | ||
} | ||
env = a127Env || getEnvironment(); | ||
@@ -114,2 +110,17 @@ | ||
function findAppRoot() { | ||
var root = _.find([ | ||
process.env.A127_APPROOT, | ||
path.resolve(__dirname).split('/node_modules')[0], | ||
path.dirname(require.main.filename), | ||
process.cwd() | ||
], | ||
function(test) { | ||
return test && fs.existsSync(path.resolve(test, 'config')) && fs.existsSync(path.resolve(test, 'api')); | ||
}); | ||
if (!root) { throw new Error('Can\'t find application root directory. Try setting env var: A127_APPROOT'); } | ||
debug('Application root: %s', root); | ||
return root; | ||
} | ||
function resolveRelativeProjectPaths(config) { | ||
@@ -116,0 +127,0 @@ var magic = config['a127.magic']; |
{ | ||
"name": "a127-magic", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"description": "Apigee 127 Swagger Loader and Middleware", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
631
103645