From 351195d7b5cba304f42940ade5d2bae51904934f Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Sun, 16 Jul 2023 21:01:04 -0600 Subject: [PATCH] feat: configure SQL on app startup if user config is ready --- backend/app.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/app.ts b/backend/app.ts index 9f31a09..3bdac92 100644 --- a/backend/app.ts +++ b/backend/app.ts @@ -7,6 +7,7 @@ import { log } from './log'; import { ensureFiles } from './data'; import { UserConfig } from './UserConfig'; import { ServerConfiguration } from 'ass'; +import { MySql } from './sql/mysql'; /** * Custom middleware to attach the ass object (and construct the `host` property) @@ -63,6 +64,9 @@ async function main() { await new Promise((resolve) => UserConfig.readConfigFile().then(() => resolve(void 0)) .catch((err) => (err.code && err.code === 'ENOENT' ? {} : console.error(err), resolve(void 0)))); + // If user config is ready, try to configure SQL + if (UserConfig.ready) await MySql.configure(); + // Set up Express const app = express();