From 2bc87e9414ba8d35b1ea5693792574d7441ab75b Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Sun, 13 Nov 2016 07:24:29 +1100 Subject: [PATCH] Use a separate file for the private SSID config. (#268) --- .travis.yml | 2 +- README.md | 4 +--- include/.gitignore | 1 + include/ssid_config.h | 23 +++++------------------ 4 files changed, 8 insertions(+), 22 deletions(-) create mode 100644 include/.gitignore diff --git a/.travis.yml b/.travis.yml index 4bd0884..c00c5d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ before_install: script: - cd ${TRAVIS_BUILD_DIR} # Remove ssid_config requirement for examples - - sed -i "s%#error%//#error%" include/ssid_config.h + - echo -e '#define WIFI_SSID "mywifissid"\n#define WIFI_PASS "my secret password"\n' > include/private_ssid_config.h # Don't verbose-build all examples (too much output), only verbose-build errors - ( ${MAKE_CMD} ) || ( ${MAKE_CMD} V=1 ) # build bootloader diff --git a/README.md b/README.md index 1fa76bc..6f1a381 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,13 @@ git clone --recursive https://github.com/Superhouse/esp-open-rtos.git cd esp-open-rtos ``` -* To build any examples that use WiFi, edit `include/ssid_config.h` and change the two macro defines: +* To build any examples that use WiFi, create `include/private_ssid_config.h` defining the two macro defines: ```c #define WIFI_SSID "mywifissid" #define WIFI_PASS "my secret password" ``` -Remove the `#warning` line and follow the git ignore instructions written in the header file to keep your credentials from being pushed to Github. - * Build an example project (found in the 'examples' directory) and flash it to a serial port: ``` diff --git a/include/.gitignore b/include/.gitignore new file mode 100644 index 0000000..c452a26 --- /dev/null +++ b/include/.gitignore @@ -0,0 +1 @@ +private_ssid_config.h diff --git a/include/ssid_config.h b/include/ssid_config.h index a13e09a..9136731 100644 --- a/include/ssid_config.h +++ b/include/ssid_config.h @@ -3,29 +3,16 @@ // // We all need to add our personal SSID/password to each ESP project but we // do not want that information pushed to Github. This file solves that -// problem. +// problem. Create an include/private_ssid_config.h file with the following two +// definitions uncommented: // -// First tell git to ignore changes to this file: +// #define WIFI_SSID "mywifissid" +// #define WIFI_PASS "my secret password" // -// git update-index --assume-unchanged include/ssid_config.h -// -// Then, enter your SSID and passphrase below and it will never be committed -// to Github. -// -// Change password on project basis? Copy the default version this file to your -// project directory, redo the instructions and you have separate wifi settings -// for that project. -// -// For reference, see -// https://www.kernel.org/pub/software/scm/git/docs/git-update-index.html -// - -#error "You need to enter your wifi credentials in this file and follow the instructions here to keep the password safe from Github commits." #ifndef __SSID_CONFIG_H__ #define __SSID_CONFIG_H__ -#define WIFI_SSID "mywifissid" -#define WIFI_PASS "my secret password" +#include "private_ssid_config.h" #endif // __SSID_CONFIG_H__