Skip to content

Commit

Permalink
make localaddress-agent optional 📝
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jan 26, 2024
1 parent 5c30757 commit 7e9e095
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@
"hafas-client": "^5.16.0",
"hafas-gtfs-rt-feed": "^8.1.0",
"ioredis": "^5.0.3",
"localaddress-agent": "^2.0.1",
"normalize-vbb-station-name-for-search": "^1.0.0",
"quick-lru": "^5.1.1",
"slugg": "^1.2.1"
},
"optionalDependencies": {
"localaddress-agent": "^2.0.1"
},
"devDependencies": {
"@derhuerst/technical-docs-cli": "^1.5.0",
"eslint": "^8.0.0",
Expand Down
10 changes: 10 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ It also needs the [`sponge` command](https://linux.die.net/man/1/sponge) from th

The [`start.sh` script](start.sh) requires at least Bash 5.0 to run (because it uses `5.0`); macOS currently bundles Bash 3.2, so use `brew install bash` to install an up-to-date version.

#### Optional: dynamic local addresses from a range

As an optional feature, when polling the HAFAS API, `berlin-gtfs-rt-server` uses IP addresses from a pool defined in `$RANDOM_LOCAL_ADDRESSES_PREFIX` as local addresses. [`localaddress-agent`](https://github.com/derhuerst/localaddress-agent) is used for this, which currently only supports Linux.

`localaddress-agent` is defined as an [optional dependency](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#optionaldependencies), so its installation will be attempted, but a failure won't cause the whole `npm install` command to fail. By setting the `$RANDOM_LOCAL_ADDRESSES_PREFIX` environment variable, you make its installation mandatory.

Refer to [`localaddress-agent`'s installation instructions](https://github.com/derhuerst/localaddress-agent/blob/main/readme.md#installation) for its required dependencies.

### Cloning

```shell
git clone https://github.com/derhuerst/berlin-gtfs-rt-server.git
cd berlin-gtfs-rt-server
Expand Down

0 comments on commit 7e9e095

Please sign in to comment.