Netlify.toml environment variables not picked up by Netlify Dev

This is the look of my netlify.toml:

[build]
publish = "public"
command = "hugo --gc --minify"
functions = ".functions"

[build.environment]
HUGO_VERSION = "0.55.1"
FIRSTNAME = "Deliriumovich"

Yet when I run my site locally with netlify dev the FIRSTNAME env variable is not being picked up.

The site runs Hugo and retrives the var with Hugo’s getenv.

The var is being picked up when live on netlify though.

@regisphilibert I think you can track this issue

Hey Tony! Nice to see you here :wink:

I believe the issues you share mention context specific vars for Netliy Dev which I would also love to see happening (hence my ealiest post :wink:) .

But here, I just need my default environment vars to be picked up by Netlify Dev and because the Doc mentions them as being already part of Netlify Dev, I assumed this would work right now.

If not, what’s the best way to pass env variables to Netlify Dev until this issue is addressed and we can do it with netlify.toml?

1 Like

Yes, I see what you mean now. Nice to see you here too!

2 Likes

Regis,

Have you tried putting them into the web dashboard console for the site?

The default context in the netlify.toml is really the same issue from what I understand. In the build the context environment overwrites the dashboard values, which is what we want in Netlify Dev also.

@regisphilibert I think that the best way to use pre-set environment variables with Netlify Dev right now is to set them in the UI for the site the codebase is linked to. We are dreaming as @talves pointed out of improving that facility (e.g. with feature request: support for environment settings specific to [dev] · Issue #444 · netlify/cli · GitHub), and it feels likely to me before we leave beta we will probably have something in place. But for now, variables set in our UI should be available, others (e.g. from some context in the netlify.toml file) may not unless you have them set in your local shell.

Hi @fool!

I’m glad you’re thinking about addressing that as tempering with Netlify dashboard while developing locally kind of takes the fun away from Netlify Dev :smiley:
Until them, of course this process is prefectly fine! This product is actually quite amazing for a beta!

Keep up the great work and thanks for your answer!

And thank you @talves for initially pointing me toward the right direction.

2 Likes

Any development on this? I’m trying to setup env variables for my devs (so they don’t have to export from their .bashrc) in the netlify.toml file like this, but it doesn’t seem to do anything.

[context.development.environment]
HELLO = "WORLD"

Hey donavon,

a thing you might try is to look through the issues here:

We may already know about this / have this filed, that is the best place to check :+1:
You are also welcome to file an issue if you would like.

Old thread resurrection :rofl: had me confused for a moment.

Hey @donavon - Netlify dev fully supports .env files. Super simple and easy way to load local development env vars :+1:t2: hope that helps!


Jon

1 Like