forked from lyfe00011/levanter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (23 loc) · 678 Bytes
/
index.js
File metadata and controls
24 lines (23 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { Client, logger } = require('./lib/client')
const { DATABASE, VERSION } = require('./config')
const { stopInstance } = require('./lib/pm2')
const start = async () => {
logger.info(`levanter ${VERSION}`)
try {
await DATABASE.authenticate({ retry: { max: 3 } })
} catch (error) {
const databaseUrl = process.env.DATABASE_URL
logger.error({ msg: 'Unable to connect to the database', error: error.message, databaseUrl })
return stopInstance()
}
try {
logger.info('Database syncing...')
await DATABASE.sync()
const bot = new Client()
await bot.init()
await bot.connect()
} catch (error) {
logger.error(error)
}
}
start()