Skip to content

Commit

Permalink
Enable setting the port and allowPrivateAddress through environment vars
Browse files Browse the repository at this point in the history
By setting

      BEHIND_PROXY: "true"
      HOLLO_PORT: 80
      ALLOW_PRIVATE_ADDRESS: "true"

one allows private addresses and runs on port 80.
  • Loading branch information
HelgeKrueger committed Oct 27, 2024
1 parent 876c624 commit 246b66f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SECRET_KEY=secret_key # generate a secret key with `openssl rand -base64 32`
LOG_LEVEL=info
LOG_QUERY=false
BEHIND_PROXY=false
LISTEN_PORT=3000 # if BEHIND_PROXY=true used as port for the server
REMOTE_ACTOR_FETCH_POSTS=10
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
Expand Down
1 change: 1 addition & 0 deletions src/federation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ if (getRedisUrl() == null) {
export const federation = createFederation<void>({
kv,
queue,
allowPrivateAddress: process.env["ALLOW_PRIVATE_ADDRESS"] === "true"
});

federation
Expand Down
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ app.get("/nodeinfo/2.0", (c) => c.redirect("/nodeinfo/2.1"));

// biome-ignore lint/complexity/useLiteralKeys: tsc complains about this (TS4111)
const BEHIND_PROXY = process.env["BEHIND_PROXY"] === "true";
const HOLLO_PORT = Number.parseInt(process.env["LISTEN_PORT"] ?? 3000, 10);

export default BEHIND_PROXY ? { fetch: behindProxy(app.fetch.bind(app)) } : app;
export default BEHIND_PROXY ? { fetch: behindProxy(app.fetch.bind(app)), port: HOLLO_PORT } : app;

0 comments on commit 246b66f

Please sign in to comment.