* docs: prepare Vendoo 1.41.2 git-ignore boundary hotfix * fix: track native source modules with root-anchored runtime ignores
16 lines
594 B
JavaScript
16 lines
594 B
JavaScript
import { db } from '../../../lib/db.mjs';
|
|
|
|
export function readApplicationSettings() {
|
|
const rows = db.prepare('SELECT key, value FROM settings').all();
|
|
return Object.fromEntries(rows.map(row => [row.key, row.value]));
|
|
}
|
|
|
|
export function writeApplicationSettings(settings) {
|
|
const stmt = db.prepare('INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)');
|
|
const transaction = db.transaction(entries => {
|
|
for (const [key, value] of entries) stmt.run(key, value == null ? '' : String(value));
|
|
});
|
|
transaction(Object.entries(settings));
|
|
return readApplicationSettings();
|
|
}
|