I’m researching quite a while now for getting into the secrets of passing some variable values at build time. Here was a thread that I walked through but I’m not satisfied yet. These values are not for public sharing i.e. if you want to share your code online on github or similar services (secrets, ips, URLs, etc.pp.)
Thread I studied:
There are still some questions i.E:
I have tons of variables in my main.cpp file like (IPAdress, subnet, gateway, secrets like passwords, URLs, etc. pp.) - shall I really add these all to my platformio.ini file (as suggested as dynamic build flags)? In my opinion, it would be great if I could put them into one separate file in my project. Is this feasible? Is there a better solution to this problem I’m not aware of? Is there a better best practice?
Anyhow - if I go with the proposed solution of the mentioned thread I can’t share my platfomio.ini file anymore on github (if add it to the gitignore file) - isn’t that bad practice?
Could one of you spend a little bit of time to answer my questions?
In the special case that the platformio.ini just uses build flags with the reference to the environment variable names, it wouldn’t contain any secrets.
all this does is to say "fetch the current value of the system environment variable ENV_WIFI_PW and put it in the C/C++ macro WIFI_PASSWORD. A user would then still have to execute
export ENV_WIFI_PW="abcdefgh"
(command depending on the OS used)
to fill it with a concrete value.
Thus you can also see that an editable file is much easier to work with.
@maxgerhardt: Ah ok, from system vars - no you’re absolutely right, that’s not what I want. But many thanks for your clarifications. Very nice explanations!