Skip to content

Commit aff8d35

Browse files
author
Brian Genisio
committed
Adding an endpoint to configure environment variables via HTTP
This will let the session send the credentials over to the LibreChat instance
1 parent 4b00421 commit aff8d35

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

api/server/routes/config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ const publicSharedLinksEnabled =
1919
(process.env.ALLOW_SHARED_LINKS_PUBLIC === undefined ||
2020
isEnabled(process.env.ALLOW_SHARED_LINKS_PUBLIC));
2121

22+
router.post('/env', async function (req, res) {
23+
const {key, value} = req.query;
24+
25+
const allowedKeys = [
26+
'BEDROCK_AWS_DEFAULT_REGION',
27+
'BEDROCK_AWS_ACCESS_KEY_ID',
28+
'BEDROCK_AWS_SECRET_ACCESS_KEY',
29+
];
30+
31+
if (!allowedKeys.includes(key)) {
32+
return res.status(400).send({ error: 'Invalid key' });
33+
}
34+
35+
process.env[key] = value;
36+
res.status(200).send({
37+
message: 'Environment variable updated',
38+
});
39+
});
40+
2241
router.get('/', async function (req, res) {
2342
const cache = getLogStores(CacheKeys.CONFIG_STORE);
2443
const cachedStartupConfig = await cache.get(CacheKeys.STARTUP_CONFIG);

0 commit comments

Comments
 (0)