Change initial SpaceAPI response source

- The environment variable is now called SPACE_API_JSON_TEMPLATE_PATH
- It is now the path to a file with the initial values, not the JSON itself
- Updated README.md accordingly
This commit is contained in:
Bendodroid 2023-11-04 23:30:26 +01:00
commit 1a9922d5f1
Signed by: bendodroid
GPG key ID: 3EEE19A0F73D5FFC
2 changed files with 26 additions and 14 deletions

View file

@ -1,14 +1,12 @@
# SpaceAPI Daemon
`spaceapid` serves a [SpaceAPI](https://spaceapi.io)-compatible JSON on port
8080:
`spaceapid` serves a [SpaceAPI](https://spaceapi.io)-compatible JSON on port 8080:
```shell
curl -X GET http://localhost:8080
```
The state of the boolean `state->open` property can be modified via
`/state/open`:
The state of the boolean `state->open` property can be modified via `/state/open`:
```shell
curl -X PUT -u user:password -d true http://localhost:8080/state/open
@ -16,8 +14,8 @@ curl -X PUT -u user:password -d true http://localhost:8080/state/open
## Building
See the `go.mod` file for minimum required Go version. There are currently no
dependencies other than the Go standard library.
See the `go.mod` file for minimum required Go version. There are currently no dependencies apart from the Go
standard library.
```shell
go build .
@ -28,5 +26,5 @@ go build .
Substitute the environment variables with appropriate custom values.
```shell
env DOORIS_USERNAME=user DOORIS_PASSWORD=password SPACE_API_JSON="$(cat ccchh-template.json)" go run .
env DOORIS_USERNAME=user DOORIS_PASSWORD=password SPACE_API_JSON_TEMPLATE_PATH=ccchh-template.json go run .
```