ily.li/src/main.ts

29 lines
794 B
TypeScript

import {delimiter} from "path";
// Load config from specified path or default + swaf/config (default defaults)
process.env['NODE_CONFIG_DIR'] =
__dirname + '/../node_modules/swaf/config/'
+ delimiter
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../config/');
import config from "config";
import {promises as fs} from "fs";
import {logger} from "swaf/Logger";
import App from "./App.js";
(async () => {
logger.debug('Config path:', process.env['NODE_CONFIG_DIR']);
const packageJson = JSON.parse((await fs.readFile('package.json')).toString());
const app = new App(
packageJson.version,
config.get<string>('app.listen_addr'),
config.get<number>('app.port'),
);
await app.start();
})().catch(err => {
logger.error(err);
});