🔧 feat: optional librechat.yaml path via environment variable (#1858)

Co-authored-by: afel <andreas.feldl@netlight.com>
This commit is contained in:
Andreas 2024-02-26 19:59:19 +01:00 committed by GitHub
parent c1a4733d50
commit 7a55132e42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -40,6 +40,12 @@ DEBUG_CONSOLE=false
# UID=1000
# GID=1000
#===============#
# Configuration #
#===============#
# CONFIG_PATH="/alternative/path/to/librechat.yaml"
#===================================================#
# Endpoints #
#===================================================#

View file

@ -5,7 +5,7 @@ const { getLogStores } = require('~/cache');
const { logger } = require('~/config');
const projectRoot = path.resolve(__dirname, '..', '..', '..', '..');
const configPath = path.resolve(projectRoot, 'librechat.yaml');
const defaultConfigPath = path.resolve(projectRoot, 'librechat.yaml');
let i = 0;
@ -16,6 +16,9 @@ let i = 0;
* @returns {Promise<TCustomConfig | null>} A promise that resolves to null or the custom config object.
* */
async function loadCustomConfig() {
// Use CONFIG_PATH if set, otherwise fallback to defaultConfigPath
const configPath = process.env.CONFIG_PATH || defaultConfigPath;
const customConfig = loadYaml(configPath);
if (!customConfig) {
i === 0 &&