0.91.0: `process.env.VARIABLE` no longer available from postcss

Since v0.91.0, process.env is no longer available from tailwind.config.js processed by Hugo Pipes: the following:

typeof process.env.HUGO_ENV !== "undefined"

Systematically returns false.

Could it be be because of the new security restrictions? Does process needs to be “allowed” somehow to one of the settings? Has any body also stumbled upon this?

1 Like

process.env.HUGO_ENV

process.env.HUGO_ENVIRONMENT

EDIT: I don’t think this is the problem. I didn’t realize you could use either.

I’m passing the environment variable myself using my CI settings or a goold old HUGO_ENV=something hugo serve. So the name of the variable is not in question. I know security settings by default only allow HUGO_ environment variable, but

  1. This would allow this one
  2. I’m not sure it even concerns PostCSS as this is set on security.getenv

You need to do this:

[security.exec]
osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM|HUGO_ENV)$']

Or this:

[security.exec]
osEnv = ['.*$']

Thanks @jmooring! You’re being so helpful like always!

You’re welcome.

If you use HUGO_ENVIRONMENT you don’t have to jump through the config hoops.

I think we need to add HUGO_ENV to the os/exec environment.

https://github.com/gohugoio/hugo/issues/9490
https://github.com/gohugoio/hugo/pull/9491

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