Skip to content

Commit

Permalink
Use OpenAI API Key from env var OPENAI_API_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
tvlgiao authored Apr 21, 2023
1 parent ed591ff commit 7ad927f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ if (process.env.RATE_LIMIT_MAX) {
config.rateLimit.max = parseInt(process.env.RATE_LIMIT_MAX, 10);
}

if (process.env.OPENAI_API_KEY) {
config.services = config.services || {};
config.services.openai = config.services.openai || {};
config.services.openai.apiKey = process.env.OPENAI_API_KEY;
}

if (process.argv.includes('--self-signed')) {
config.tls = {
selfSigned: true,
Expand All @@ -137,4 +143,4 @@ if (config.publicSiteURL) {

export {
config
};
};

0 comments on commit 7ad927f

Please sign in to comment.