homepage.js/startup.js

32 lines
658 B
JavaScript
Raw Normal View History

2023-02-13 02:16:46 +01:00
console.log('Executing startup jobs...');
2023-02-18 14:41:24 +01:00
if (process.env.APP_DEBUG) {
process.env.DEBUG = '*/*';
}
2023-02-13 02:16:46 +01:00
const fs = require('fs');
const hrt = () => {
let hr = process.hrtime();
return hr[0] + hr[1] / 1000000;
}
async function startup() {
let t1 = hrt();
let dotpath = (process.env.APP_DEBUG == 'true') ? '.env.debug' : '.env.prod';
if (!fs.existsSync(dotpath)) dotpath = '.env';
require('dotenv').config({
path: dotpath
});
await require('./helpers').ViewLoader.preload();
console.log('Views compiled in ' + (hrt() - t1) + ' ms');
console.log('Finished in ' + (hrt() - t1) + " ms");
}
startup();