Merge pull request #940 from WilliButz/fix-configurable-paths

enhance configurabiltiy of paths & make execution path-independent
This commit is contained in:
Christoph (Sheogorath) Kern 2018-10-05 22:21:01 +02:00 committed by GitHub
commit 32af96aa37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 45 deletions

5
app.js
View file

@ -126,6 +126,9 @@ app.use(i18n.init)
// routes without sessions
// static files
app.use('/', express.static(path.join(__dirname, '/public'), { maxAge: config.staticCacheTime }))
app.use('/docs', express.static(path.resolve(__dirname, config.docsPath), { maxAge: config.staticCacheTime }))
app.use('/uploads', express.static(path.resolve(__dirname, config.uploadsPath), { maxAge: config.staticCacheTime }))
app.use('/default.md', express.static(path.resolve(__dirname, config.defaultNotePath), { maxAge: config.staticCacheTime }))
// session
app.use(session({
@ -167,7 +170,7 @@ app.use(require('./lib/web/middleware/codiMDVersion'))
// routes need sessions
// template files
app.set('views', path.join(__dirname, '/public/views'))
app.set('views', config.viewPath)
// set render engine
app.engine('ejs', ejs.renderFile)
// set view engine