Files
incus-backup-ui/backend/src/routes/settings.js
T
2026-05-21 08:18:29 +02:00

24 lines
524 B
JavaScript

import { Router } from 'express';
import { readEnvSettings, writeEnvSettings } from '../config.js';
export const settingsRouter = Router();
settingsRouter.get('/', async (_req, res, next) => {
try {
res.json({ fields: await readEnvSettings() });
} catch (error) {
next(error);
}
});
settingsRouter.put('/', async (req, res, next) => {
try {
res.json({
fields: await writeEnvSettings(req.body?.values || {}),
message: 'Settings saved.',
});
} catch (error) {
next(error);
}
});