Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make npm run start/start_prod accept HOST_ADDRESS #16

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ https://github.com/delpa-org/melpa-snapshot-*.

For more information about Delpa, see https://delpa.org.

## Build
## Build and Run

You need [podman][] installed.
You need [podman][] and [npm][] installed.

To build the server for production, run:

npm run build_prod

To start the server for production, run:

HOST_ADDRESS="example.org" npm run start_prod

You need to replace `example.org` with your own server address.
[Any address acceptable by Caddy](https://caddyserver.com/docs/caddyfile/concepts#addresses) works.
If no `HOST_ADDRESS` is specified, then it is set to `localhost`.

## Development

You need [podman][] installed.
You need [podman][] and [npm][] installed.

To build the server for test, run:

Expand All @@ -26,6 +34,9 @@ To start the server, run:

npm run start

It also accepts an optional `HOST_ADDRESS` environment variable, same as the
production container image.

After starting the test server, to run test:

npm run test
Expand All @@ -34,4 +45,5 @@ The `snapshot_versions.json` file in this repo is deliberately set wrong and for
test purpose only. In production build, it will be replaced by the file grabbed
from https://delpa.org/snapshot_versions.json.

[npm]: https://docs.npmjs.com/cli
[podman]: https://podman.io/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "npm run compile && eslint *.ts *.mjs && prettier . --check",
"build": "podman build --build-arg snapshot_versions_type=test . -t delpa-redirection-test-server",
"build_prod": "podman build . -t delpa-redirection-server",
"start": "podman run -it --rm -p 3000:80 -p 3001:443 delpa-redirection-test-server",
"start": "podman run -it --rm -p 3000:80 -p 3001:443 --env HOST_ADDRESS delpa-redirection-test-server",
"start_prod": "podman run -it --rm -p 3000:80 -p 3001:443 --env HOST_ADDRESS delpa-redirection-test-server",
"test": "NODE_TLS_REJECT_UNAUTHORIZED=0 vitest --run index.test.ts",
"test_prod": "NODE_TLS_REJECT_UNAUTHORIZED=0 vitest --run prod.test.ts",
"format": "eslint --fix *.ts *.mjs && prettier . --write",
Expand Down