[www] + Config model; config updated; using remote config; server refactoring

This commit is contained in:
Roman Timashev committed 2017-09-19 13:45:06 +03:00
1 parent 18a0b36a09
commit 5ad321ec0e
7 files changed
+85 -69

No files matched your search

+15 -6
View File
@@ -5,17 +5,18 @@ export const configFile = process.env['PRIVATE'] || 'private.json'
const privateData = JSON.parse(fs.readFileSync(configFile, 'utf-8'))
const indexFile = process.env['INDEX'] || 'templates/main.html'
const port = process.env['PORT'] || 1800
export const port = process.env['PORT'] || 1800
const value = (name, def) => name in privateData
? privateData[name]
: def
const config = {
port: port,
pub: './',
db: {
uri: 'mongodb://localhost:27017/hudozka'
},
}
export const dbUri = value('dbUri', 'mongodb://localhost:27017/hudozka')
export default Object.keys(privateData)
.reduce((config, key) => {
config[key] = privateData[key]
@@ -46,3 +47,11 @@ export const instagramToken = privateData['instagramToken']
export const viewMain = path.join(__dirname, 'views/main.hbs')
export const view404 = path.join(__dirname, 'views/404.hbs')
export const sessionConfig = {
key: 'sid', /** (string) cookie key */
maxAge: 86400000, /** (number) maxAge in ms */
overwrite: false, /** (boolean) can overwrite or not */
httpOnly: false, /** (boolean) httpOnly or not */
signed: true, /** (boolean) signed or not */
}