Keys and such

You should never, ever put keys and other confidential information in code. I have all mine in environment variables and I use a shell script to put them in a header field that gets included. If you use this approach, just be careful to add that header file to .gitignore.

# Set any env vars needed to build

rm secrets.h
echo "#define WIFI_PASS   \"$WIFI_PASSWORD\"" >> secrets.h
echo "#define WIFI_SSID   \"$WIFI_SSID\"" >> secrets.h
echo "#define HUE_USER    \"$HUE_USER\"" >> secrets.h
echo "#define DARKSKY_KEY \"$DARKSKY_KEY\"" >> secrets.h
echo "#define AIO_USER    \"$AIO_USER\"" >> secrets.h
echo "#define AIO_KEY     \"$AIO_KEY\"" >> secrets.h
echo "" >> secrets.h

This will result in a file that looks like:

#define WIFI_PASS   "....................."
#define WIFI_SSID   "....."
#define HUE_USER    "..................................."
#define DARKSKY_KEY "....................................."
#define AIO_USER    "......"
#define AIO_KEY     "......................................."
This guide was first published on Feb 14, 2018. It was last updated on Sep 05, 2018. This page (Keys and such) was last updated on Feb 08, 2018.