feat(devtui): enhance config tab with env fields, HTTP cache toggle, and envfile package#1050
Conversation
Add an APP_ENV picker to the devtui Config tab so users can switch the Symfony application environment (dev/prod/test) without leaving the dashboard. The value is persisted to .env.local, preserving surrounding lines and comments. envfile gains ReadAppEnv/WriteAppEnv helpers for the read-then-update flow.
Replace the APP_ENV-specific plumbing with a small envFieldDef registry in tab_config.go so adding another .env-backed choice field later means appending one struct literal — picker, render, load, and save flow are all driven from the registry. The envfile package gains generic ReadValue/ReadValues/WriteValue/ WriteValues helpers; .env.local writes still replace assignments in place, with batch appends emitted in deterministic order.
Add a SHOPWARE_HTTP_CACHE_ENABLED entry to the env-field registry so the Config tab exposes an HTTP Cache toggle alongside APP_ENV. Selections are persisted to .env.local as "0"/"1", while the UI shows the friendlier "disabled"/"enabled" labels via an optional choiceLabels mapping on envFieldDef.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1586cc7c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| projectRoot := m.projectRoot | ||
| cfg := m.config | ||
| return func() tea.Msg { | ||
| if err := dockerpkg.WriteComposeFile(projectRoot, dockerpkg.ComposeOptionsFromConfig(cfg)); err != nil { |
There was a problem hiding this comment.
Regenerate compose with merged local profiler secrets
When config is saved, updateConfigTab calls ApplyToConfig, which clears profiler credential fields from m.config, then writes secrets to local config only. This restart path regenerates compose.yaml from m.config, so in Docker mode a save with Blackfire/Tideways enabled can restart containers without BLACKFIRE_*/TIDEWAYS_APIKEY env wiring even though the user-provided secrets were persisted. This breaks profiler functionality immediately after save until config is reloaded with local overrides.
Useful? React with 👍 / 👎.
| m.configTab.modified = false | ||
| m.configTab.err = nil | ||
| if m.dockerMode { | ||
| m.configTab.saved = false | ||
| m.configTab.restarting = true | ||
| return m, m.restartContainersForConfig() |
There was a problem hiding this comment.
Allow retry after Docker restart failure
The save flow clears modified before launching the async Docker restart. If docker compose up -d fails, handleConfigRestartDone sets an error but does not re-mark the form as modified; pressing Enter on "Retry Save" then does nothing because save is gated by m.configTab.modified. In practice, users cannot retry the failed restart without making an unrelated extra change first.
Useful? React with 👍 / 👎.
Summary
dev/prod/testSymfony environmentsSHOPWARE_HTTP_CACHE_ENABLEDfield with friendly "disabled"/"enabled" labelsenvFieldDefregistry so adding new.env-backed fields is a single struct literalReadValue/ReadValues/WriteValue/WriteValueshelpers for reading and writing.env.localfiles with in-place replacementinternal/sbompackage, Cloudsmith goreleaser config, stale Twig comment testdata files, and dead mysqldump codeTest plan
go test ./...passes.env.localSHOPWARE_HTTP_CACHE_ENABLED=0/1in.env.local