Netlify.toml environment variables not picked up by Netlify Dev

answered
#1

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.

#2

@regisphilibert I think you can track this issue

#3

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
#4

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

2 Likes
#5

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.

#6

@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 https://github.com/netlify/netlify-dev-plugin/issues/114), 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.

#7

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.

1 Like