CONFIG_FILE => CONFIG_PATH

d97aa0a270c1282490bfc2b8bf10add67969d1c8

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +6 -6Showing whitespace changes
src/util.js+6 -6
@@ -23,7 +23,7 @@ import { serverDirectory } from './server-directory.js';
2323 * Parsed config object.
2424 */
2525let CACHED_CONFIG = null;
2626let CONFIG_FILECONFIG_PATH = null;
2727
2828/**
2929 * Converts a configuration key to an environment variable key.
@@ -38,10 +38,10 @@ export const keyToEnv = (key) => 'SILLYTAVERN_' + String(key).toUpperCase().repl
3838 * @param {string} configFilePath Path to the config file
3939 */
4040export function setConfigFilePath(configFilePath) {
4141 if (CONFIG_FILECONFIG_PATH !== null) {
4242 console.error(color.red('Config file path already set. Please restart the server to change the config file path.'));
4343 }
4444 CONFIG_FILECONFIG_PATH = path.resolve(configFilePath);
4545}
4646
4747/**
@@ -49,7 +49,7 @@ export function setConfigFilePath(configFilePath) {
4949 * @returns {object} Config object
5050 */
5151export function getConfig() {
5252 if (CONFIG_FILECONFIG_PATH === null) {
5353 console.trace();
5454 console.error(color.red('No config file path set. Please set the config file path using setConfigFilePath().'));
5555 process.exit(1);
@@ -57,14 +57,14 @@ export function getConfig() {
5757 if (CACHED_CONFIG) {
5858 return CACHED_CONFIG;
5959 }
6060 if (!fs.existsSync(CONFIG_FILECONFIG_PATH)) {
6161 console.error(color.red('No config file found. Please create a config.yaml file. The default config file can be found in the /default folder.'));
6262 console.error(color.red('The program will now exit.'));
6363 process.exit(1);
6464 }
6565
6666 try {
6767 const config = yaml.parse(fs.readFileSync(CONFIG_FILECONFIG_PATH, 'utf8'));
6868 CACHED_CONFIG = config;
6969 return config;
7070 } catch (error) {