Hugo OS env vars question

I found that Hugo CLI doesn’t pick up the OS env vars in this way.

$ echo $HUGO_MODULE_PROXY
https://goproxy.cn

$ echo $HUGO_CACHEDIR  
/home/razonyang/.cache/hugo

$ hugo server -p 13131 

I store those env vars inside ~/.zshrc, but those env vars won’t be used by Hugo, however HTTPS_PROXY and HTTP_PROXY works on this way.

But set the env vars at the same line works.

$ HUGO_CACHEDIR=${HOME}/.cache/hugo HUGO_MODULE_PROXY=https://goproxy.cn hugo server -p 13131

EDITED:

OS: Arch Linux
Bash: ZSH

I’m not sure what you mean by “doesn’t pick up”, but I would be surprised if what you describe doesn’t work. That’s in line with what I’m doing all the time on both MacOS and Linux.

We’re using this Go function to read env vars:

I’m not familiar with Arch Linux; maybe they have some way of filtering the env variables that’s available to the running process?

I’m not sure, I capture a video about this, Hugo caches modules into /tmp/hugo_cache instead of HUGO_CACHEDIR.

https://asciinema.org/a/548855

Moved the env vars to ~/.zprofile works, sorry for the noise.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.