Skip to content
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

env.development has precedence over env.local #4394

Open
paulschuetz opened this issue Nov 28, 2024 · 0 comments
Open

env.development has precedence over env.local #4394

paulschuetz opened this issue Nov 28, 2024 · 0 comments
Labels
kind/bug Something isn't working status/triage

Comments

@paulschuetz
Copy link

paulschuetz commented Nov 28, 2024

What is the problem?

Blitz being a framework on top of next js, I think it should behave very similar in standard functionality such as environment configuration. However there is currently a big difference in the order in which environment variables are loaded.

Imagine you have the following files

.env.local
FAVORITE_COLOR=green

.env.development
FAVORITE_COLOR=red

At runtime when running on next with next dev the value of FAVORITE_COLOR will be green because naturally your local config via .env.local has precedence over the default development config via .env.development, see docs. However if you run this with blitz via blitz dev, FAVORITE_COLOR will be red. I would highly recommend sticking to the next js order of loading env vars! what do you think?

Blitz version: 2.1.3 (local)
Linux 6.8 | linux-x64 | Node: v20.16.0


 Package manager: npm

  System:
    OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
    Memory: 17.36 GB / 27.23 GB
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.16.0 - /tmp/yarn--1732804901444-0.5375225702750697/node
    Yarn: 1.22.22 - /tmp/yarn--1732804901444-0.5375225702750697/yarn
    npm: 10.4.0 - ~/workbench/krisenchat/krisenchat/node_modules/.bin/npm
  npmPackages:
    @blitzjs/auth: 2.1.3 => 2.1.3 
    @blitzjs/next: 2.1.3 => 2.1.3 
    @blitzjs/rpc: 2.1.3 => 2.1.3 
    @prisma/client: 5.22.x => 5.22.0 
    blitz: 2.1.3 => 2.1.3 
    next: 14.2.13 => 14.2.13 
    prisma: 5.22.0 => 5.22.0 
    react: ~18.3.1 => 18.3.1 
    react-dom: ~18.3.1 => 18.3.1 
    typescript: 5.6.3 => 5.6.3 
@paulschuetz paulschuetz added kind/bug Something isn't working status/triage labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working status/triage
Projects
None yet
Development

No branches or pull requests

1 participant