Skip to content

fix(cli): support env files in app deploy#72

Open
AmanVarshney01 wants to merge 4 commits into
mainfrom
aman/app-deploy-env-file
Open

fix(cli): support env files in app deploy#72
AmanVarshney01 wants to merge 4 commits into
mainfrom
aman/app-deploy-env-file

Conversation

@AmanVarshney01
Copy link
Copy Markdown
Member

Summary

  • allow prisma-cli app deploy --env .env alongside --env NAME=VALUE
  • reuse the existing dotenv file reader used by env management commands
  • keep duplicate-key/name validation centralized through the existing deploy env assignment parser
  • update deploy help/spec examples to show --env <name=value|file>

Why

app deploy --env currently only accepts inline NAME=VALUE values. Passing .env is treated as an invalid assignment because the deploy path always calls the assignment parser directly, even though the CLI already has dotenv file parsing for env commands.

Validation

  • pnpm --filter @prisma/cli test
  • pnpm --filter @prisma/cli build
  • live smoke: node packages/cli/dist/cli.js app deploy --prod --http-port 8080 --env .env --yes --json
  • verified deployed URL responds after the env-file deploy

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8012b455-687a-4e10-8efa-565f095f6a75

📥 Commits

Reviewing files that changed from the base of the PR and between e793063 and 3fb0fe0.

📒 Files selected for processing (10)
  • docs/product/command-spec.md
  • packages/cli/src/commands/app/index.ts
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/lib/app/branch-database-deploy.ts
  • packages/cli/src/lib/app/env-file.ts
  • packages/cli/src/lib/app/env-vars.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/tests/app-branch-database.test.ts
  • packages/cli/tests/app-env-vars.test.ts
  • packages/cli/tests/app.test.ts

Summary by CodeRabbit

  • New Features

    • Extended --env flag to accept dotenv file paths (e.g., --env .env) in addition to inline NAME=VALUE assignments.
    • Database environment variables provided via --env now suppress automatic database prompting.
  • Bug Fixes

    • Prevented invalid combinations of --db with database environment variables via --env.

Walkthrough

This PR extends the prisma-cli app deploy --env flag to accept either inline NAME=VALUE assignments or dotenv file paths (e.g., --env .env). A new parseEnvInputs function unifies both input forms by detecting inputs without = as file paths, reading their contents, and merging results with direct assignments before final validation. The option key naming in maybeSetupBranchDatabase shifts from inlineEnvVars to providedEnvVars to reflect that environment variables can now originate from either source. Documentation, help text, and tests are updated accordingly.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change—adding support for env files in the app deploy command.
Description check ✅ Passed The description clearly explains the feature addition, rationale, and validation steps performed, all directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aman/app-deploy-env-file
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch aman/app-deploy-env-file

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@AmanVarshney01 AmanVarshney01 marked this pull request as ready for review June 5, 2026 11:56
@AmanVarshney01 AmanVarshney01 requested a review from luanvdw June 5, 2026 11:56
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