mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
use try & catch
This commit is contained in:
parent
c4b0fbafea
commit
1542b8982c
43
bin/boot.js
43
bin/boot.js
@ -126,26 +126,31 @@ async function injectEnvFromInfisical() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function Boot(main) {
|
async function Boot(main) {
|
||||||
if (!main) {
|
try {
|
||||||
throw new Error("main class is not defined")
|
if (!main) {
|
||||||
|
throw new Error("main class is not defined")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.INFISICAL_TOKEN) {
|
||||||
|
console.log(`[BOOT] INFISICAL_TOKEN found, injecting env variables from INFISICAL...`)
|
||||||
|
await injectEnvFromInfisical()
|
||||||
|
}
|
||||||
|
|
||||||
|
const instance = new main()
|
||||||
|
|
||||||
|
await instance.initialize()
|
||||||
|
|
||||||
|
if (process.env.lb_service && process.send) {
|
||||||
|
process.send({
|
||||||
|
status: "ready"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.INFISICAL_TOKEN) {
|
|
||||||
console.log(`[BOOT] INFISICAL_TOKEN found, injecting env variables from INFISICAL...`)
|
|
||||||
await injectEnvFromInfisical()
|
|
||||||
}
|
|
||||||
|
|
||||||
const instance = new main()
|
|
||||||
|
|
||||||
await instance.initialize()
|
|
||||||
|
|
||||||
if (process.env.lb_service && process.send) {
|
|
||||||
process.send({
|
|
||||||
status: "ready"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[BOOT] Booting in [${global.isProduction ? "production" : "development"}] mode...`)
|
console.log(`[BOOT] Booting in [${global.isProduction ? "production" : "development"}] mode...`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user