Use a separate file for the private SSID config. (#268)

This commit is contained in:
Our Air Quality 2016-11-13 07:24:29 +11:00 committed by sheinz
parent bc50c7c2fc
commit 2bc87e9414
4 changed files with 8 additions and 22 deletions

View file

@ -40,7 +40,7 @@ before_install:
script: script:
- cd ${TRAVIS_BUILD_DIR} - cd ${TRAVIS_BUILD_DIR}
# Remove ssid_config requirement for examples # 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 # Don't verbose-build all examples (too much output), only verbose-build errors
- ( ${MAKE_CMD} ) || ( ${MAKE_CMD} V=1 ) - ( ${MAKE_CMD} ) || ( ${MAKE_CMD} V=1 )
# build bootloader # build bootloader

View file

@ -33,15 +33,13 @@ git clone --recursive https://github.com/Superhouse/esp-open-rtos.git
cd esp-open-rtos 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 ```c
#define WIFI_SSID "mywifissid" #define WIFI_SSID "mywifissid"
#define WIFI_PASS "my secret password" #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: * Build an example project (found in the 'examples' directory) and flash it to a serial port:
``` ```

1
include/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
private_ssid_config.h

View file

@ -3,29 +3,16 @@
// //
// We all need to add our personal SSID/password to each ESP project but we // 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 // 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__ #ifndef __SSID_CONFIG_H__
#define __SSID_CONFIG_H__ #define __SSID_CONFIG_H__
#define WIFI_SSID "mywifissid" #include "private_ssid_config.h"
#define WIFI_PASS "my secret password"
#endif // __SSID_CONFIG_H__ #endif // __SSID_CONFIG_H__