webappengine
Version:
A web application server that can host multiple web apps running with Node.js.
40 lines (36 loc) • 1.08 kB
JavaScript
import crypto from 'crypto';
import os from 'os';
import path from 'path';
import urljoin from '../lib/urljoin';
import pkg from '../../../package.json';
// hashedVersion
const hashedVersion = ((version) => {
const algorithm = 'sha1';
const buf = String(version);
const hash = crypto.createHash(algorithm).update(buf).digest('hex');
return hash.substr(0, 8); // 8 digits
})(pkg.version);
const maxAge = (365 * 24 * 60 * 60 * 1000); // one year
export default {
hashedVersion: hashedVersion,
assets: {
// web
web: {
routes: [ // with trailing slash
urljoin(hashedVersion, '/'), // hashed route
'/' // fallback
],
path: path.resolve(__dirname, '..', '..', 'web'),
maxAge: maxAge
}
},
cluster: {
// note. node-inspector cannot debug child (forked) process
enable: false,
maxWorkers: os.cpus().length || 1
},
winston: {
// https://github.com/winstonjs/winston#logging-levels
level: 'info'
}
};