feat: configure SQL on app startup if user config is ready

pull/243/head
Josh Moore 1 year ago
parent 488f5c15e3
commit 351195d7b5

@ -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();

Loading…
Cancel
Save