Closed Reinbert closed 4 years ago
Thanks for the PR!
@valeros, please re-test on Win/Unix.
@valeros, please provide a unit test for this case.
Thanks a lot for the PR, it might be a good idea to transform WIFI_SSID
and WIFI_PASS
to separate environment variables and pass them to your project via Dynamic Variables
Hi there!
I tried to inject my Wifi credentials on Ubuntu 16.04 via platformio's environment build flags by appending each statement to the end of my
.bashrc
file. However, the stated Unix examples did not work for me. As I suspect that other systems are affected too, I suggest the following changes to the docs. In detail:export PLATFORMIO_BUILD_FLAGS=-DFOO
(Works)export PLATFORMIO_BUILD_FLAGS=-DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07
Error when opening a new terminal:Adding single quotes around all values fixes this:
export PLATFORMIO_BUILD_FLAGS='-DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07'
export PLATFORMIO_BUILD_FLAGS='-DWIFI_PASS=\"My password\"' '-DWIFI_SSID=\"My ssid name\"'
Build flags are cut off after first pair of single quotes. Solution: Enclose all flags in one pair of single quotes:export PLATFORMIO_BUILD_FLAGS='-DWIFI_PASS=\"My password\" -DWIFI_SSID=\"My ssid name\"'
(I did not check the flags on Windows)
Additionally: I changed the order of password and ssid flag and added a statement to look out for escaping rules of special characters. E.g.: My password contains a single
$
which needs to be escaped like this:\$\$
. (Doubling $ for CMake and \ for bash)Cheers, Reinbert