fix(cli): wrapper の source .env を devbase root 限定にする#18
Merged
Conversation
`bin/devbase` は CWD 直下の `.env` を無条件で bash source していたため、
project ディレクトリ (例: carmo-system-console) で `devbase down` を実行
すると Laravel ランタイム用 `.env` を読み込んでしまい、CRLF 改行や
`|` / `&` 等の特殊文字を値に含む行で syntax error / `: command not found`
となり全コマンドが起動不能になっていた。
compose は `env_file` 指定および同階層 `.env` を自前で読むため、wrapper
側で project の `.env` を source する必要は無い。source の本来の意図は
devbase root の `.env` (AWS / BigQuery 等 devbase ツール用変数) を取り込む
ことなので、source 対象を `${DEVBASE_ROOT}/.env` に限定する。
Co-Authored-By: Claude Opus 4.7 <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
bin/devbaseline 18 が CWD 直下の.envを無条件で bash source していたため、project ディレクトリ (例: Laravel プロジェクト) でdevbase down/upを実行するとランタイム用.envを source してしまい、CRLF 改行や|/&等の特殊文字を含む値で: command not found/syntax errorとなり全コマンドが起動不能になっていた.env(AWS / BigQuery 等の devbase ツール用変数) を取り込むことなので、対象を${DEVBASE_ROOT}/.envに限定する.envを読むため、wrapper 側で project の.envを bash source する必要は無い影響範囲
.env読み込み: ✅ 引き続き機能env(compose 用 GIT_USER / GIT_REPO 等の小さなファイル) の source: ✅ 変更なし (line 19 そのまま).envから bash 変数を期待していたカスタムスクリプトがあれば 影響を受けるが、Python (lib/) からの参照は無く、.envの値は compose の${VAR}展開で使われるのみ再現手順 (修正前)
Test plan
devbase status/devbase plugin list等を実行し、AWS_PROFILE / BIGQUERY_* 等の env が引き続き Python 側に渡ることを確認.envを持つ project ディレクトリ (carmo-system-console 等) からdevbase down/devbase upがエラーなく走ることを確認${DB_DATABASE}等の変数展開が従来通り動作することを確認🤖 Generated with Claude Code