Move cookie secret to data root. Make config.yaml immutable

This commit is contained in:
Cohee
2025-02-20 20:16:44 +02:00
parent 3bb8b887e1
commit 7ea2c5f8cf
5 changed files with 45 additions and 31 deletions

View File

@@ -9,7 +9,6 @@ import { promises as dnsPromise } from 'node:dns';
import yaml from 'yaml';
import { sync as commandExistsSync } from 'command-exists';
import { sync as writeFileAtomicSync } from 'write-file-atomic';
import _ from 'lodash';
import yauzl from 'yauzl';
import mime from 'mime-types';
@@ -58,19 +57,6 @@ export function getConfigValue(key, defaultValue = null) {
return _.get(config, key, defaultValue);
}
/**
* Sets a value for the given key in the config object and writes it to the config.yaml file.
* @param {string} key Key to set
* @param {any} value Value to set
*/
export function setConfigValue(key, value) {
// Reset cache so that the next getConfig call will read the updated config file
CACHED_CONFIG = null;
const config = getConfig();
_.set(config, key, value);
writeFileAtomicSync('./config.yaml', yaml.stringify(config));
}
/**
* Encodes the Basic Auth header value for the given user and password.
* @param {string} auth username:password