mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
24 lines
648 B
TypeScript
24 lines
648 B
TypeScript
import { connect } from "../data/db";
|
|
import { setIsAPI } from "../globals";
|
|
import "./loadEnv";
|
|
|
|
if (!process.env.KEY) {
|
|
// tslint:disable-next-line:no-console
|
|
console.error("Project root .env with KEY is required!");
|
|
process.exit(1);
|
|
}
|
|
|
|
function errorHandler(err) {
|
|
console.error(err.stack || err); // tslint:disable-line:no-console
|
|
process.exit(1);
|
|
}
|
|
|
|
process.on("unhandledRejection", errorHandler);
|
|
|
|
setIsAPI(true);
|
|
|
|
// Connect to the database before loading the rest of the code (that depend on the database connection)
|
|
console.log("Connecting to database..."); // tslint:disable-line
|
|
connect().then(() => {
|
|
import("./start");
|
|
});
|