Skip to content

Change the default filename for loading environment variables to .env.local #15681

@Jinsung-L

Description

@Jinsung-L

Problem

prisma loads DATABASE_URL from .env by default but I think it should be .env.local.
From my understanding, the convention is that to use .env file to store defaults that should be included in the repository and to use .env.local file to store secrets.
And I think DATABASE_URL is a secret. Something that should not be included in the repository.

Note: .env, .env.development, and .env.production files should be included in your repository as they define defaults. .env*.local should be added to .gitignore, as those files are intended to be ignored. .env.local is where secrets can be stored.
https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables

Suggested solution

Change the default filename for loading environment variables to .env.local.

Alternatives

Add support for loading .env file variations: .env.*, .env.*.local.

Additional context

#3865
#3226

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions