Skip to content

Commit 246b66f

Browse files
committed
Enable setting the port and allowPrivateAddress through environment vars
By setting BEHIND_PROXY: "true" HOLLO_PORT: 80 ALLOW_PRIVATE_ADDRESS: "true" one allows private addresses and runs on port 80.
1 parent 876c624 commit 246b66f

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

.env.sample

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SECRET_KEY=secret_key # generate a secret key with `openssl rand -base64 32`
55
LOG_LEVEL=info
66
LOG_QUERY=false
77
BEHIND_PROXY=false
8+
LISTEN_PORT=3000 # if BEHIND_PROXY=true used as port for the server
89
REMOTE_ACTOR_FETCH_POSTS=10
910
AWS_ACCESS_KEY_ID=
1011
AWS_SECRET_ACCESS_KEY=

src/federation/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ if (getRedisUrl() == null) {
109109
export const federation = createFederation<void>({
110110
kv,
111111
queue,
112+
allowPrivateAddress: process.env["ALLOW_PRIVATE_ADDRESS"] === "true"
112113
});
113114

114115
federation

src/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ app.get("/nodeinfo/2.0", (c) => c.redirect("/nodeinfo/2.1"));
2020

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

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

0 commit comments

Comments
 (0)