Updated config path statement
config path now uses “require.main.filename” which should switch between being used a module or as an application.
This commit is contained in:
parent
3dabb4779e
commit
5c9369d57a
1 changed files with 4 additions and 1 deletions
5
app.js
5
app.js
|
@ -1,7 +1,10 @@
|
||||||
// app.js
|
// app.js
|
||||||
|
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
var config = require('read-config')(path.join(__dirname, 'config.json'))
|
// configPath = path.join(__dirname, 'config.json')
|
||||||
|
configPath = path.join(path.dirname(require.main.filename), 'config.json')
|
||||||
|
console.log('Reading config from: ' + configPath)
|
||||||
|
var config = require('read-config')(configPath)
|
||||||
var express = require('express')
|
var express = require('express')
|
||||||
var logger = require('morgan')
|
var logger = require('morgan')
|
||||||
var session = require('express-session')({
|
var session = require('express-session')({
|
||||||
|
|
Loading…
Reference in a new issue