mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Move cookie secret to data root. Make config.yaml immutable
This commit is contained in:
14
src/util.js
14
src/util.js
@@ -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
|
||||
|
Reference in New Issue
Block a user