Skip to content

Commit 20a9031

Browse files
authored
Merge pull request #495 from os2display/feature/convert-env-to-3x-command
feat: add app:utils:convert-env-to-3x command
2 parents c3ea1f0 + 926413d commit 20a9031

4 files changed

Lines changed: 908 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- [#495](https://github.com/os2display/display-api-service/pull/495)
8+
- Added `app:utils:convert-env-to-3x` command that converts the loaded configuration of a running 2.x
9+
installation (env vars + admin/client config.json) to 3.x environment configuration, with screen,
10+
dotenv and docker compose output formats.
711
- [#486](https://github.com/os2display/display-api-service/pull/486)
812
- Changed BRND feed area and facility filters to match on `områdeId` and `facilitetsId` instead of area/facility names.
913
- Mapped area and facility IDs centrally in `parseBrndBooking()`.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,48 @@ variable](https://symfony.com/doc/current/components/phpunit_bridge.html#configu
308308
docker compose exec --env SYMFONY_DEPRECATIONS_HELPER=disabled phpfpm composer tests
309309
```
310310

311+
## Preparing an upgrade to 3.x
312+
313+
The `app:utils:convert-env-to-3x` command converts the configuration of this
314+
(2.x) installation to 3.x environment configuration. The values _loaded_ in
315+
the running application are treated as canonical — whether they come from
316+
real environment variables, a docker compose `environment` block or
317+
`.env`/`.env.local` files — and every variable the application reads is
318+
written out under its 3.x name.
319+
320+
Unless `--skip-config-json` is given, the command also fetches the canonical
321+
admin and client configuration from `<app-url>/admin/config.json` and
322+
`<app-url>/client/config.json` and converts them to the 3.x `ADMIN_*` and
323+
`CLIENT_*` variables. The base URL is inferred from the loaded OIDC redirect
324+
URIs (or `COMPOSE_DOMAIN`) and can be overridden with `--app-url`.
325+
326+
```shell
327+
# Review on screen (default):
328+
docker compose exec phpfpm bin/console app:utils:convert-env-to-3x
329+
330+
# Write a dotenv file ON THE HOST, the starting point for the 3.x .env.local.
331+
# With --output=env (and --output=compose) the document goes to stdout and all
332+
# notes/warnings go to stderr, so the result can be redirected from outside
333+
# the container (-T: no TTY, keeps stdout byte-clean):
334+
docker compose exec -T phpfpm bin/console app:utils:convert-env-to-3x \
335+
--output=env --app-url=https://display.example.com > env.3x
336+
337+
# Or a docker compose environment block:
338+
docker compose exec -T phpfpm bin/console app:utils:convert-env-to-3x --output=compose > env.3x.yml
339+
```
340+
341+
Note that `--file` writes inside the container, so it only makes sense for
342+
paths on a mounted volume; prefer the host-side redirect above in dockerised
343+
setups.
344+
345+
Loaded variables the Symfony application cannot read (`COMPOSE_*`, `PHP_*`,
346+
`NGINX_*`, `MARIADB_*`/`MYSQL_*`) are listed in a trailing advisory with a
347+
note on where each belongs in a 3.x deployment: compose orchestration values
348+
go in the docker host `.env`, and the container-tuning values go on the
349+
respective containers (`.env.php`, `.env.nginx`, `.env.mariadb` in the
350+
`os2display-docker-server` file layout). They are never part of the
351+
application env output.
352+
311353
## CI
312354

313355
Github Actions are used to run the test suite and code style checks on all PRs.

0 commit comments

Comments
 (0)