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
CONFIG_GOLIOTH_SYSTEM_CLIENT_PSK_ID="my-psk-id"
CONFIG_GOLIOTH_SYSTEM_CLIENT_PSK="my-psk"

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:

build*/
.vscode
credentials.conf

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