[www] config optimisation: removed private.json
This commit is contained in:
1 parent
ec8d18b587
commit
396b7a6d40
2 files changed
+4
-24
No files matched your search
+2
-22
@@ -1,34 +1,14 @@
|
|||||||
import fs from 'fs'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
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'
|
|
||||||
export const port = process.env['PORT'] || 1800
|
export const port = process.env['PORT'] || 1800
|
||||||
|
export const dbUri = process.env['DB_URI'] || 'mongodb://localhost:27017/hudozka'
|
||||||
const value = (name, def) => name in privateData
|
|
||||||
? privateData[name]
|
|
||||||
: def
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
pub: './',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dbUri = value('dbUri', 'mongodb://localhost:27017/hudozka')
|
|
||||||
|
|
||||||
export default Object.keys(privateData)
|
|
||||||
.reduce((config, key) => {
|
|
||||||
config[key] = privateData[key]
|
|
||||||
return config
|
|
||||||
}, config)
|
|
||||||
|
|
||||||
export const name = 'Hudozka'
|
export const name = 'Hudozka'
|
||||||
export const host = 'art.shlisselburg.org'
|
export const host = 'art.shlisselburg.org'
|
||||||
export const protocol = 'https://'
|
export const protocol = 'https://'
|
||||||
export const homeUrl = protocol + host
|
export const homeUrl = protocol + host
|
||||||
|
|
||||||
export const index = path.join(__dirname, indexFile)
|
export const index = path.join(__dirname, 'templates/main.html')
|
||||||
export const sitemapCacheTime = 600000// 600 sec - cache purge period
|
export const sitemapCacheTime = 600000// 600 sec - cache purge period
|
||||||
|
|
||||||
export const viewMain = path.join(__dirname, 'views/main.hbs')
|
export const viewMain = path.join(__dirname, 'views/main.hbs')
|
||||||
|
|||||||
+2
-2
@@ -11,13 +11,13 @@ const isEqualPate = require('../lib/url').isEqualPath
|
|||||||
const {compose, any} = require('../lib/common')
|
const {compose, any} = require('../lib/common')
|
||||||
|
|
||||||
const menuModel = require('../models/menu').default
|
const menuModel = require('../models/menu').default
|
||||||
const config = require('../config')
|
const {viewMain} = require('../config')
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
commentsEnabled: false,
|
commentsEnabled: false,
|
||||||
showAuthor: false,
|
showAuthor: false,
|
||||||
menuPadding: false,
|
menuPadding: false,
|
||||||
templateFile: config.viewMain,
|
templateFile: viewMain,
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultMeta = {
|
const defaultMeta = {
|
||||||
|
|||||||
Reference in new issue
Block a user