Skip to content

feat: add env_migrate task for the 2.x to 3.x configuration conversion#40

Open
turegjorup wants to merge 1 commit into
developfrom
feature/env-migrate-task
Open

feat: add env_migrate task for the 2.x to 3.x configuration conversion#40
turegjorup wants to merge 1 commit into
developfrom
feature/env-migrate-task

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Summary

Adds an env_migrate wrapper task that converts the configuration of the running 2.x installation to a 3.x-shaped env file on the host. It wraps the api console command app:utils:convert-env-to-3x (os2display/display-api-service#495, ships with display-api-service >= 2.8) and redirects its stdout to .env.symfony.migrated, so the result survives container restarts — --file inside the container would not.

Features Added

  • task env_migrate: runs app:utils:convert-env-to-3x --output=env in the api container with exec -T and redirects the dotenv document to .env.symfony.migrated on the host. The command emits the document on stdout and all notes/warnings on stderr, so the file stays a clean parseable dotenv while the operator still sees warnings in the terminal.
  • --app-url defaulting: the site's public URL is taken from COMPOSE_SERVER_DOMAIN in .env.docker.local so the admin/client config.json conversion works out of the box; any caller-supplied --app-url wins, and other args are forwarded (task env_migrate -- --skip-config-json).
  • Safety: friendly error (instead of a console stack trace) when the pinned api image predates the command; writes through a temp file so a failed run cannot leave a truncated result; .env.symfony.migrated* is gitignored since the file contains secrets (APP_SECRET, DB credentials, OIDC client secrets).

Files Changed

  • Taskfile.yml — new env_migrate task + entry in the default help listing
  • README.md — "Upgrading to 3.x" task documentation
  • CHANGELOG.md — unreleased entry
  • .gitignore — ignore .env.symfony.migrated*

Test Plan

  • task --list parses and shows the new task
  • task env_migrate without a running stack prints the friendly version hint and exits non-zero
  • The stdout/stderr piping contract is covered by tests in display-api-service PR #495 and was verified end-to-end against a running container (clean dotenv on stdout incl. when config.json fetches fail, warnings on stderr, no ANSI escapes, single trailing newline)

🤖 Generated with Claude Code

Wraps the api console command app:utils:convert-env-to-3x
(display-api-service >= 2.8, os2display/display-api-service#495):
runs it inside the api container and redirects the dotenv document to
.env.symfony.migrated on the host, where it survives container
restarts.

- stdout/stderr split: the document goes through the redirect, the
  command's notes and warnings stay visible on the terminal.
- Defaults --app-url from COMPOSE_SERVER_DOMAIN so the admin/client
  config.json conversion works out of the box; extra CLI args are
  forwarded (task env_migrate -- --skip-config-json).
- Friendly error when the pinned api image predates the command.
- Writes via a temp file so a failed run cannot leave a truncated
  result; .env.symfony.migrated* is gitignored (it contains secrets).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant