feat: run SQL mode switch during setup

pull/243/head
Josh Moore 1 year ago
parent 0a45ddcd37
commit 51a7b304f4

@ -2,6 +2,8 @@ import { path } from '@tycrek/joint';
import { Router, json as BodyParserJson } from 'express';
import { log } from '../log';
import { UserConfig } from '../UserConfig';
import { setDataModeToSql } from '../data';
import { MySql } from '../sql/mysql';
const router = Router({ caseSensitive: true });
@ -23,6 +25,9 @@ router.post('/', BodyParserJson(), async (req, res) => {
// Save config
await UserConfig.saveConfigFile();
// Set data storage (not files) to SQL if required
await Promise.all([MySql.configure(), setDataModeToSql()]);
return res.json({ success: true });
} catch (err: any) {
return res.status(400).json({ success: false, message: err.message });

Loading…
Cancel
Save