🔍 feat: Fetch Google Service Key and Consolidate Key Loading Logic (#8179)

This commit is contained in:
Danny Avila 2025-07-01 22:37:29 -04:00 committed by GitHub
parent 738d04fac4
commit 59d00e99f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 89 additions and 34 deletions

View file

@ -1,5 +1,5 @@
const fs = require('fs');
const path = require('path');
const { loadServiceKey } = require('@librechat/api');
const { EModelEndpoint } = require('librechat-data-provider');
const { isUserProvided } = require('~/server/utils');
const { config } = require('./EndpointService');
@ -18,15 +18,7 @@ async function loadAsyncEndpoints(req) {
path.join(__dirname, '../../..', 'data', 'auth.json');
try {
if (process.env.GOOGLE_SERVICE_KEY_FILE_PATH) {
const absolutePath = path.isAbsolute(serviceKeyPath)
? serviceKeyPath
: path.resolve(serviceKeyPath);
const fileContent = fs.readFileSync(absolutePath, 'utf8');
serviceKey = JSON.parse(fileContent);
} else {
serviceKey = require('~/data/auth.json');
}
serviceKey = await loadServiceKey(serviceKeyPath);
} catch {
if (i === 0) {
i++;