Configure app with data path globals

parent ec6408f3
......@@ -18,6 +18,8 @@ const path = require('path')
process.env['NODE_CONFIG_DIR'] = path.join(__dirname, 'config/')
const configuration = require('@feathersjs/configuration')
const globals = require('./globals')
const express = require('@feathersjs/express')
const primus = require('@feathersjs/primus')
......@@ -34,6 +36,10 @@ const app = express(feathers())
// Load app configuration
app.configure(configuration())
// Set globals
app.configure(globals)
// Enable CORS, security, compression, favicon and body parsing
app.use(cors())
app.use(helmet())
......
// Configure globals that can be accessed from a reference to the app.
const path = require('path')
const os = require('os')
module.exports = function (app) {
const dataDirectoryPath = path.join(os.homedir(), '.indie', 'site')
const serverSecretFilePath = path.join(dataDirectoryPath, 'server-secret.json')
const ownerKeysFilePath = path.join(dataDirectoryPath, 'owner-keys.json')
const ownerSettingsFilePath = path.join(dataDirectoryPath, 'owner-settings.json')
app.set('dataDirectoryPath', dataDirectoryPath)
app.set('serverSecretFilePath', serverSecretFilePath)
app.set('ownerKeysFilePath', ownerKeysFilePath)
app.set('ownerSettingsFilePath', ownerSettingsFilePath)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment