mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 14:49:07 +00:00
33 lines
920 B
TypeScript
33 lines
920 B
TypeScript
import logger from 'CommonServer/Utils/Logger';
|
|
import App from 'CommonServer/Utils/StartServer';
|
|
import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase';
|
|
import FetchCertificateJobs from './Jobs/FetchCertificates';
|
|
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
|
|
|
|
const APP_NAME: string = 'ingress';
|
|
|
|
const init: PromiseVoidFunction = async (): Promise<void> => {
|
|
try {
|
|
// init the app
|
|
await App(APP_NAME);
|
|
|
|
// connect to the database.
|
|
await PostgresAppInstance.connect(
|
|
PostgresAppInstance.getDatasourceOptions()
|
|
);
|
|
|
|
// init the jobs
|
|
FetchCertificateJobs.init();
|
|
} catch (err) {
|
|
logger.error('App Init Failed:');
|
|
logger.error(err);
|
|
throw err;
|
|
}
|
|
};
|
|
|
|
init().catch((err: Error) => {
|
|
logger.error(err);
|
|
logger.info('Exiting node process');
|
|
process.exit(1);
|
|
});
|