2023-06-22 01:07:19 +02:00
|
|
|
// require('dotenv').config({ override: true });
|
|
|
|
import { config } from 'dotenv';
|
|
|
|
config({ override: true });
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log(`Starting in ${process.env.NODE_ENV} mode`);
|
|
|
|
|
2023-12-03 21:12:01 +01:00
|
|
|
import Controller from './src/middleware/Controller.js';
|
2023-06-22 01:07:19 +02:00
|
|
|
import { readFileSync } from 'node:fs';
|
2023-12-03 21:12:01 +01:00
|
|
|
import path from 'node:path';
|
2023-12-05 19:31:53 +01:00
|
|
|
import { ControllerOptions } from './@types/Controller.js';
|
2023-12-03 21:12:01 +01:00
|
|
|
|
2023-12-05 19:31:53 +01:00
|
|
|
const options = JSON.parse(readFileSync('./options.json', { encoding: 'utf-8' })) as ControllerOptions;
|
|
|
|
const pkg = JSON.parse(readFileSync('./package.json', { encoding: 'utf-8' }));
|
2023-06-22 01:07:19 +02:00
|
|
|
const { version } = pkg;
|
|
|
|
|
2023-12-03 21:12:01 +01:00
|
|
|
const srcDir = path.join(process.cwd(), 'build', 'src');
|
2023-12-05 19:31:53 +01:00
|
|
|
options.rootDir = srcDir;
|
2023-06-22 01:07:19 +02:00
|
|
|
|
2023-12-03 21:12:01 +01:00
|
|
|
new Controller(options, version)
|
|
|
|
.build();
|