From 1025c840685d258a6cd5cf98777d864305daf21f Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Sat, 23 May 2026 07:27:52 +0900 Subject: [PATCH] =?UTF-8?q?fix(cli):=20wrapper=20=E3=81=AE=20source=20.env?= =?UTF-8?q?=20=E3=82=92=20devbase=20root=20=E9=99=90=E5=AE=9A=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 --- bin/devbase | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/devbase b/bin/devbase index a9aa9cc..a4b6222 100755 --- a/bin/devbase +++ b/bin/devbase @@ -15,7 +15,12 @@ DEVBASE_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" # Environment setup export DOCKER_GID=$( [ "$(uname)" = "Darwin" ] && echo "0" || grep docker /etc/group | cut -d: -f3 ) export COMPOSE_PROJECT_NAME=$(basename "$PWD") -[ -f ".env" ] && set -a && source .env && set +a +# devbase root の .env (AWS / BigQuery 等の devbase ツール用変数) を読み込む。 +# project ディレクトリで実行された場合に Laravel ランタイム用 .env を bash で +# source すると、CRLF 改行や `|` / `&` 等の特殊文字を含む値で syntax error に +# なる。compose は同階層の .env を自動で読むため wrapper 側で project .env を +# source する必要は無い。 +[ -f "${DEVBASE_ROOT}/.env" ] && set -a && source "${DEVBASE_ROOT}/.env" && set +a [ -f "env" ] && set -a && source ./env && set +a # Export for Python modules