Secreting configurations for github

Hi everyone.

In my Platformio project I have a configuration file which will have all the internal configurations in this form


I want to publicly share it on GitHub so that everyone that looks on my configuration file will see only the lefthand side of the configurations so that everyone will be able to insert their values to the file like this.

//what everyone sees on GitHub

the configurations have to be pushed to my C++ code via the CPPDEFINES argument in the script being called from platformio.ino via the extra_scripts directive. Another issue that arises is the necessity to provide the full path to the configuration file on my computer in the script (I know I could insert the configurations directly to the python file but this would not be an optimal solution) which is not a best practice when sharing code.

Does PlatformIO offer solutions for this case?

Thanks, Mark

  • secret.ini.dist – contains the config WITHOUT the values, the way you want it, it is a “distribution”/“template” file, tracked by git
  • secret.ini – should be git-ignored, contains values to be used – just copy secret.ini.dist into secret.ini and fill in the values when you clone the repo
  • extra_config = secret.ini – that’s how you load it in the platformio.ini


1 Like