Skip to content

Commit

Permalink
Rename LISTEN_PORT to PORT
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Nov 2, 2024
1 parent 4b511a1 commit 1a9d55d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To be released.

- Added a favicon.

- Added `LISTEN_PORT` and `ALLOW_PRIVATE_ADDRESS` environment variables.
- Added `PORT` and `ALLOW_PRIVATE_ADDRESS` environment variables.
[[#53] by Helge Krueger]

[#38]: https://github.com/dahlia/hollo/issues/38
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ RUN \
&& mv .pkg.json package.json; \
fi

ENV LISTEN_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "prod"]
2 changes: 1 addition & 1 deletion docs/src/content/docs/install/env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Hollo is configured using environment variables. You can set them in an *.env*
file in the root directory of the project, or you can set them using Docker's
`-e`/`--env` option or Railway's environment variables.

### `LISTEN_PORT` <Badge text="Optional" /> <Badge text="Unused in Railway" variant="tip" />
### `PORT` <Badge text="Optional" /> <Badge text="Unused in Railway" variant="tip" />

The port number to listen on. 3000 by default.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/ja/install/env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Holloは環境変数を使って設定を行います。
Dockerの`-e`/`--env`オプションを使うか、
Railwayのenvironment variablesメニューから設定できます。

### `LISTEN_PORT` <Badge text="オプション" /> <Badge text="Railwayでは使われない" variant="tip" />
### `PORT` <Badge text="オプション" /> <Badge text="Railwayでは使われない" variant="tip" />

サーバーが受信するポート番号。デフォルトは3000です。

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/ko/install/env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Hollo는 환경 변수를 통해 여러 가지 설정을 할 수 있습니다.
Docker의 `-e`/`--env` 옵션을 쓰거나,
Railway의 environment variables 메뉴에서 설정할 수 있습니다.

### `LISTEN_PORT` <Badge text="선택" /> <Badge text="Railway에서는 안 쓰임" variant="tip" />
### `PORT` <Badge text="선택" /> <Badge text="Railway에서는 안 쓰임" variant="tip" />

서버가 수신할 포트 번호. 기본값은 3000입니다.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/zh-cn/install/env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Aside, Badge } from '@astrojs/starlight/components';

Hollo是通过环境变量进行配置的。你可以在项目根目录的 *.env* 文件中设置它们,或者使用Docker的`-e`/`--env`选项或Railway的环境变量进行设置。

### `LISTEN_PORT` <Badge text="可选" /> <Badge text="Railway中未使用" variant="tip" />
### `PORT` <Badge text="可选" /> <Badge text="Railway中未使用" variant="tip" />

服务器监听的端口号。默认为3000。

Expand Down
8 changes: 4 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ app.get("/favicon.png", async (c) => {
const BEHIND_PROXY = process.env["BEHIND_PROXY"] === "true";

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

if (!Number.isInteger(LISTEN_PORT)) {
console.error("Invalid LISTEN_PORT: must be an integer");
if (!Number.isInteger(PORT)) {
console.error("Invalid PORT: must be an integer");
process.exit(1);
}

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

0 comments on commit 1a9d55d

Please sign in to comment.