Conversation
Some projects eventually need to leave Omen's dynamic detection behind
(e.g. exiting Druid for a single known host). Reader::eject() is a
drop-in replacement for Reader::get() that additionally writes
settings.ejected.php: a static, human-reviewable rewrite of the
currently detected configuration with no Omen dependency - the
detected system's env translation inlined, Defaults' dev/test/prod
branches rendered as match(), and any all.settings.php/{env}.settings.php
inlined. It never deletes or renames anything itself.
Every System class now implements getEjectedCode() to describe its own
eject template, mirroring its getEnvs()/setConfiguration() logic.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
all.settings.php/{env}.settings.php were already inlined verbatim (so
an include inside one of those already survived), but a project-
specific include tacked on directly in settings.php after the Omen
call - e.g. colosseum's `include 'valkey.settings.php';` for Valkey
config - was silently dropped, since Ejector never read that file.
Ejector now scans the real settings.php for include/include_once/
require/require_once statements with a plain quoted filename and
carries them forward verbatim into settings.ejected.php.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Druidfi\Omen\Reader::eject(get_defined_vars())as a drop-in replacement forReader::get(): it returns the same['config', 'databases', 'settings']array, and additionally writessettings.ejected.phpnext tosettings.phpfor review.getenv()-based translation logic inlined,Defaults' dev/test/prod branches rendered asmatch ($app_env) {...}, and any existingall.settings.php/dev.settings.php/test.settings.php/prod.settings.phpinlined (local.settings.php/local.services.ymlare intentionally left dynamic, not inlined).eject()never deletes or renames anything itself - it's meant for the "leaving Druid / leaving the dynamic-detection model" workflow: temporarily swapget()foreject(), trigger one request, review the generated file, then rename/delete/composer removemanually. Workflow documented inCLAUDE.md.Systemclass (Ddev,Lagoon,Lando,Pantheon,Tugboat,Upsun,Wodby) now implements a newgetEjectedCode()method mirroring its owngetEnvs()/setConfiguration()logic as static PHP.Test plan
composer test(all 8 systems × dev/test/prod = 24 runs) passestestEject()toDdevTest,LagoonTest,UnknownTest: assertseject()returns the same conf asget(), and that actuallyrequire-ing the generatedsettings.ejected.phpreproduces the same$config/$databases/$settingsReader::get()and executing the generated file for all 8 systems, which caught and fixed two fidelity bugs before this PR: aportstring/int mismatch, and a missingDRUSH_OPTIONS_URIfallback for the no-system-detected case🤖 Generated with Claude Code