Co-authored-by: Madison Grubb <madison@elastiflow.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
import { getDb, closeDb } from '../utils/db.js'
|
||||
import { migrateFeedsToDevices } from '../utils/migrateFeedsToDevices.js'
|
||||
|
||||
/**
|
||||
* Initialize DB (and run bootstrap if no users) at server startup
|
||||
* so credentials are printed in the terminal before any request.
|
||||
* Initialize DB at server startup.
|
||||
* Close DB on server shutdown to avoid native sqlite3 crashes in worker teardown.
|
||||
*/
|
||||
// eslint-disable-next-line no-undef
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
void getDb().then(() => migrateFeedsToDevices())
|
||||
void getDb()
|
||||
nitroApp.hooks.hook('close', () => {
|
||||
closeDb()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user