WIFI sysenv fails

Hello,
I have a problem with sysenv variables. I have not change my code but I cant charge the values of wifi ssid and password.

My platformio.io file:

build_flags =
  -DWIFI_SSID=${sysenv.WIFI_SSID}
  -DWIFI_PASS=${sysenv.WIFI_PASSWORD}

My src/main.cpp

#define WIFI_SSID "asd"
#define WIFI_PASS "asd"
...
  while (WiFi.status() != WL_CONNECTED) {
    delay(WIFI_DELAY);
    Serial.println("Conectando al wifi...");
    Serial.println(WIFI_SSID);
  }

The result:

Conectando al wifi...
asd
Conectando al wifi...
asd
Conectando al wifi...
asd
Conectando al wifi...
asd

If I build from command line and y do a echo $WIFI_SSID they are correctly setted.

Complete code: GitHub - dbgjerez/iot-esp8266-irrigation-system: System to measure ground humidity
Thanks a lot

How do you change the environment variables?

You do restart VSCode after that too?

I have wrote them into my .bashrc. It was working along some weeks, but today…

$ cat ~/.bashrc | grep WIFI*
export WIFI_SSID="MiFibra-32FD"
export WIFI_PASSWORD="mypassword"

I have restart VSCode, my computer and I have build from command line too. :frowning:

Have you logged out and logged in your user account to apply changes to that file?

Yeah, I put them almost one month ago, and it was working.

For example, in new terminal:

$ echo $WIFI_SSID
MiFibra-32FD

Have you removed those lines

otherwise you’re redefining it.

Also per docs you might need to have to shell-escape the environment variable.

Thanks bro!

I have delete those lines and escape the environment variable:

export WIFI_SSID='\"MiFibra-32FD\"'

I dont understand how it was working before, but thanks a lot :wink: