From b2814b3ee344ec6a61dff53be26bf765f446e6da Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 9 Aug 2022 00:49:38 +0200 Subject: [PATCH] The cli now loads at the start of the server --- server/index.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/server/index.js b/server/index.js index 01ad5879..49e7fa01 100755 --- a/server/index.js +++ b/server/index.js @@ -28,7 +28,7 @@ if (process.env.NODE_ENV === 'production') { app.get('*', (req, res) => res.sendFile(path.join(__dirname, '../build', 'index.html'))); } else { app.get("*", (req, res) => res.status(500).send("

Diese MySpeed-Instanz befindet sich aktuell im Entwicklungsmodus.

" - + "Wenn du der Betreiber bist, bitte ändere deine Umgebungsvariable ab.

")); + + "Wenn du der Betreiber bist, bitte ändere deine Umgebungsvariable ab.")); } // Connect to the database @@ -40,6 +40,9 @@ const run = async () => { // Sync the database await db.sync({alter: true, force: false}); + // Load the cli + await require('./config/loadCli').load(); + await config.insertDefaults(); // Start all timer @@ -52,12 +55,10 @@ const run = async () => { app.listen(port, () => console.log(`Server listening on port ${port}`)); } -db.authenticate() - .then(() => { - console.log("Successfully connected to the database file"); - run(); - }) - .catch(err => { - console.error("Could not open the database file. Maybe it is damaged?: " + err.message); - process.exit(111); - }); \ No newline at end of file +db.authenticate().then(() => { + console.log("Successfully connected to the database file"); + run(); +}).catch(err => { + console.error("Could not open the database file. Maybe it is damaged?: " + err.message); + process.exit(111); +}); \ No newline at end of file