Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#1738 from gtoxlili/main
Browse files Browse the repository at this point in the history
fix : specify the default hostname if docker builds with a proxy
  • Loading branch information
Yidadaa authored May 24, 2023
2 parents 89f0a48 + aa2be9b commit bb3f6ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ COPY --from=builder /app/.next/server ./.next/server
EXPOSE 3000

CMD if [ -n "$PROXY_URL" ]; then \
if [ -z "$HOSTNAME" ]; then \
export HOSTNAME="127.0.0.1" \
fi; \
protocol=$(echo $PROXY_URL | cut -d: -f1); \
host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
port=$(echo $PROXY_URL | cut -d: -f3); \
Expand Down
7 changes: 5 additions & 2 deletions app/utils/format.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export function prettyObject(msg: any) {
const obj = msg;
if (typeof msg !== "string") {
msg = JSON.stringify(msg, null, " ");
}
const prettyMsg = ["```json", msg, "```"].join("\n");
return prettyMsg;
if (msg === "{}") {
return obj.toString();
}
return ["```json", msg, "```"].join("\n");
}

0 comments on commit bb3f6ee

Please sign in to comment.