Skip to content

Commit

Permalink
Merge branch 'add-env-var-for-google-auth-json'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirks committed Jan 8, 2025
2 parents 47fb1ed + c1c65ab commit 5493a36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/server/services/Endpoints/google/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { GoogleClient } = require('~/app');
const initializeClient = async ({ req, res, endpointOption, overrideModel, optionsOnly }) => {
const {
GOOGLE_KEY,
GOOGLE_KEY_JSON_FILENAME,
GOOGLE_KEY_JSON_FILE,
GOOGLE_REVERSE_PROXY,
GOOGLE_AUTH_HEADER,
PROXY,
Expand All @@ -21,12 +21,13 @@ const initializeClient = async ({ req, res, endpointOption, overrideModel, optio
userKey = await getUserKey({ userId: req.user.id, name: EModelEndpoint.google });
}

const googleKeyJsonFilename = GOOGLE_KEY_JSON_FILENAME ?? '~/data/auth.json';
const googleKeyJsonFilename = GOOGLE_KEY_JSON_FILE ?? '~/data/auth.json';
let serviceKey = {};
try {
console.log(`Loading Google service key from ${googleKeyJsonFilename}`);
serviceKey = require(googleKeyJsonFilename);
} catch (e) {
// Do nothing
console.error(`Failed to load Google service key from ${googleKeyJsonFilename} with error: ${e.message}`);
}

const credentials = isUserProvided
Expand Down

0 comments on commit 5493a36

Please sign in to comment.