|
| 1 | +# Migrate to 3.x |
| 2 | + |
| 3 | +- The `config.yml` file is no longer supported, convert it to the new env format |
| 4 | + with [`migrate-config`](#migrating-your-config). |
| 5 | +- If you set list or map environment variables, their syntax changed, see |
| 6 | + [List and map syntax](#list-and-map-syntax). |
| 7 | +- If you have scripts hitting client-token endpoints, they may now need |
| 8 | + [elevation](#adapting-your-scripts). |
| 9 | + |
| 10 | +## Config Changes |
| 11 | + |
| 12 | +### YAML config file removed |
| 13 | + |
| 14 | +The YAML config file (`config.yml`) is no longer supported. Gotify can now be |
| 15 | +only configured by environment variables, which can be loaded from an env file. |
| 16 | +The first existing file from this search order is loaded: |
| 17 | + |
| 18 | +1. `gotify-server.env` (in the working directory) |
| 19 | +2. `$XDG_CONFIG_HOME/gotify/gotify-server.env` (`$XDG_CONFIG_HOME` falls back to `$HOME/.config` when unset) |
| 20 | +3. `/etc/gotify/server.env` |
| 21 | + |
| 22 | +See the [Configuration](/docs/config) page for the full list of variables. |
| 23 | + |
| 24 | +### Migrating your config |
| 25 | + |
| 26 | +The `migrate-config` command converts an existing `config.yml` to the new env |
| 27 | +format. It prints the result to stdout. |
| 28 | + |
| 29 | +```bash |
| 30 | +$ gotify-server migrate-config config.yml > gotify-server.env |
| 31 | +``` |
| 32 | + |
| 33 | +With Docker: |
| 34 | + |
| 35 | +```bash |
| 36 | +$ docker run --rm -v "$(pwd)/config.yml:/app/config.yml" gotify/server \ |
| 37 | + migrate-config config.yml > gotify-server.env |
| 38 | +``` |
| 39 | + |
| 40 | +### Environment List and map syntax |
| 41 | + |
| 42 | +Defining settings via environment variables was already possible, but the syntax |
| 43 | +for list and map values has changed. If you set any of the variables below, update |
| 44 | +their format. |
| 45 | + |
| 46 | +**Lists** are now comma-separated instead of a YAML array: |
| 47 | + |
| 48 | +- `GOTIFY_SERVER_TRUSTEDPROXIES` |
| 49 | +- `GOTIFY_SERVER_CORS_ALLOWORIGINS` |
| 50 | +- `GOTIFY_SERVER_CORS_ALLOWMETHODS` |
| 51 | +- `GOTIFY_SERVER_CORS_ALLOWHEADERS` |
| 52 | +- `GOTIFY_SERVER_STREAM_ALLOWEDORIGINS` |
| 53 | +- `GOTIFY_SERVER_SSL_LETSENCRYPT_HOSTS` |
| 54 | +- `GOTIFY_OIDC_SCOPES` |
| 55 | + |
| 56 | +```bash |
| 57 | +# before |
| 58 | +GOTIFY_SERVER_TRUSTEDPROXIES=[127.0.0.1/32, ::1] |
| 59 | +# after |
| 60 | +GOTIFY_SERVER_TRUSTEDPROXIES=127.0.0.1/32,::1 |
| 61 | +``` |
| 62 | + |
| 63 | +**Maps** are now a JSON object instead of a YAML map: |
| 64 | + |
| 65 | +- `GOTIFY_SERVER_RESPONSEHEADERS` |
| 66 | + |
| 67 | +```bash |
| 68 | +# before |
| 69 | +GOTIFY_SERVER_RESPONSEHEADERS={X-Custom-Header: "custom value"} |
| 70 | +# after |
| 71 | +GOTIFY_SERVER_RESPONSEHEADERS={"X-Custom-Header":"custom value"} |
| 72 | +``` |
| 73 | + |
| 74 | +## API Changes |
| 75 | + |
| 76 | +Introduces step-up authentication via time-limited [session |
| 77 | +elevation](./session-elevation.md). A session/client token must re-authenticate |
| 78 | +before sensitive, hard-to-undo actions. |
| 79 | + |
| 80 | +HTTP Basic auth and application tokens are unaffected. |
| 81 | + |
| 82 | +### Endpoints that now require elevation |
| 83 | + |
| 84 | +With a non-elevated client token these return `403`: |
| 85 | + |
| 86 | +| Endpoint | Action | |
| 87 | +| :-------------------------------------------- | :----------------------------- | |
| 88 | +| `POST /current/user/password` | Change current user's password | |
| 89 | +| `DELETE /client/{id}` | Delete a client | |
| 90 | +| `DELETE /application/{id}` | Delete an application | |
| 91 | +| `POST /client/{id}/elevate` | Elevate a client token | |
| 92 | +| `GET /user`, `GET`/`POST`/`DELETE /user/{id}` | Manage users (admin) | |
| 93 | + |
| 94 | +The `Client` and `CurrentUser` models have gotten elevation-related fields. See the |
| 95 | +[API documentation](/api-docs) for details. |
| 96 | + |
| 97 | +### Adapting your scripts |
| 98 | + |
| 99 | +Scripts that hit the endpoints above with a client token now need that token to |
| 100 | +be elevated. Either: |
| 101 | + |
| 102 | +- Use HTTP Basic auth as they are elevated by default. |
| 103 | +- Elevate the client in the WebUI or the api with basic auth. |
| 104 | + |
| 105 | +## CLI Changes |
| 106 | + |
| 107 | +The binary now uses subcommands. You should migrate to using the `serve` |
| 108 | +subcommand. For backwards compatibility running gotify without a command will |
| 109 | +continue to serve the server. |
| 110 | + |
| 111 | +```bash |
| 112 | +$ ./gotify-linux-amd64 serve |
| 113 | +``` |
| 114 | + |
| 115 | +The Docker image already defaults to `serve`, so `docker run` and Docker Compose |
| 116 | +setups keep working unchanged. |
0 commit comments