Skip to content

Commit

Permalink
fix not getting correct env api addr
Browse files Browse the repository at this point in the history
  • Loading branch information
yusing committed Jan 1, 2025
1 parent a4ff8d0 commit c77af24
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
/** @type {import('next').NextConfig} */

const envPrefixes = ["GODOXY_", "GOPROXY_", ""];
let apiAddr;

for (const prefix of envPrefixes) {
apiAddr = process.env[`${prefix}API_ADDR`];
if (apiAddr !== undefined) {
break;
}
}

const apiBaseURL =
process.env.GOPROXY_API_ADDR === undefined
apiAddr === undefined
? "http://127.0.0.1:8888/v1"
: `http://${process.env.GOPROXY_API_ADDR}/v1`;
: `http://${apiAddr}/v1`;

const nextConfig = {
output: "standalone",

async rewrites() {
return [
{
Expand Down

0 comments on commit c77af24

Please sign in to comment.