Configure
Every flag, what it does, and the environment variable that sets it instead.
Every option is a flag, and every flag has an environment variable. The flag wins when both are set.
| Flag | Environment | Default | Meaning |
|---|---|---|---|
--addr | NOOKS_ADDR | :8081 | Host and port to listen on |
--data | NOOKS_DATA | ./data | Directory holding the SQLite file |
--driver | NOOKS_DRIVER | sqlite | sqlite or postgres |
--dsn | NOOKS_DSN | — | Connection string, when the driver is postgres |
--mode | NOOKS_MODE | prod | prod or dev |
--secure-cookies | NOOKS_SECURE_COOKIES | off | Marks session cookies Secure. Turn it on behind TLS |
--log-level | NOOKS_LOG_LEVEL | info | debug, info, warn or error |
Changing the port
--addr is host and port together, so the port lives there rather than in a flag of its
own:
./nooks --addr :9090Give it a host to stop it listening on every interface, which is worth doing when something else is already handling the outside world:
./nooks --addr 127.0.0.1:9090In Docker the container keeps 8081 and the host side of -p is what you change:
docker run -d -p 9090:8081 -v nooks-data:/var/lib/nooks ghcr.io/hoshomoh/nooksPostgres instead of SQLite
A flag, not a rewrite. The same schema runs on both, and the same binary serves either.
./nooks --driver postgres --dsn "postgres://nooks:nooks@localhost:5432/nooks?sslmode=disable"Postgres is worth it when more than a household is using the instance, or when the machine already runs one. For a flat, SQLite is the better answer: one file, no server.