How do I add Golioth Credentials without commiting them to git?

When running the Hello app, we tell you to put your Golioth credentials in the prj.conf file. This is not a great practice as it’s really easy to accidentally commit your credentials to a git repository. I instead like to use a separate credentials.conf file which I then add to my .gitignore file.

# credentials.conf

Then include this file at build time:

west build -b esp32 . -D OVERLAY_CONFIG=credentials.conf -p

Just remember to add credenditals.conf to your .gitignore file:


You can see a working example of this in the magtag-demo repository.