Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

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

Andreas7a55132e42c8
diff --git a/.env.example b/.env.example
index 6ecd2d8d0d..ab9b57756a 100644
--- a/.env.example
+++ b/.env.example
@@ -40,6 +40,12 @@ DEBUG_CONSOLE=false
# UID=1000
# GID=1000
+#===============#
+# Configuration #
+#===============#
+
+# CONFIG_PATH="/alternative/path/to/librechat.yaml"
+
#===================================================#
# Endpoints #
#===================================================#
diff --git a/api/server/services/Config/loadCustomConfig.js b/api/server/services/Config/loadCustomConfig.js
index eecf8eff82..dc29e3329c 100644
--- a/api/server/services/Config/loadCustomConfig.js
+++ b/api/server/services/Config/loadCustomConfig.js
@@ -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 &&