Skip to content

fix(cpa): overwrites existing env variables #10636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 1, 2025
Merged

Conversation

jessrynkar
Copy link
Member

@jessrynkar jessrynkar commented Jan 17, 2025

What?

Using create-payload-app to initialize Payload in an existing Next.js app that does not already have Payload installed overwrites any existing data in the .env and .env.example files.

The desired behavior is for Payload variables to get added with no client data lost.

How?

Updates manageEnvFiles to check for existing .env / .env.example file and appends or creates as necessary.

Adds tests to packages/create-payload-app/src/lib/create-project.spec.ts.

Fixes #10355

@jessrynkar jessrynkar requested a review from denolfe as a code owner January 17, 2025 14:14
@jessrynkar jessrynkar changed the title fix(create-payload-app): existing env variables getting overwritten chore: create-payload-app overwrites existing env variables Jan 17, 2025
@denolfe denolfe changed the title chore: create-payload-app overwrites existing env variables fix(cpa): overwrites existing env variables May 1, 2025
@denolfe denolfe enabled auto-merge (squash) May 1, 2025 16:02
@denolfe denolfe merged commit e5b28c9 into main May 1, 2025
78 checks passed
@denolfe denolfe deleted the fix/env-overwrite-cpa branch May 1, 2025 16:03
Copy link
Contributor

github-actions bot commented May 5, 2025

🚀 This is included in version v3.37.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create-payload-app in existing Next.js project replaces .env and .env.example contents
2 participants