From: Nathaniel Wesley Filardo Date: Sat, 29 Jun 2019 12:38:39 +0000 (+0100) Subject: Check in much of the device configuration X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=ab5f452fc53df893921ce1d9ff1cc53e16d7c4cf;p=acmetensortoys-esp-lua_ctfws Check in much of the device configuration Move passwords out to rewrites so that almost everything else can land. While here, make the MQTT configuration set the timeout to 100 seconds so that we get LWT messages sent much more promptly. fixup timeout --- diff --git a/README.rst b/README.rst index b1bba45..361964e 100644 --- a/README.rst +++ b/README.rst @@ -192,6 +192,7 @@ Configuration Files * ``nwfnet.conf`` has details of how to get connectivity to the network. * ``nwfnet.conf2`` sets the SNTP server to use -* ``nwfmqtt.conf`` sets the MQTT server and credentials - - +* ``nwfmqtt.conf`` sets the MQTT server and credentials; it is derived from + ``nwfmqtt.conf.in`` via ``rewrites.sed`` in the configuration directories; + note that the latter of which is deliberately not checked in. +* ``ctfws-misc.conf`` can be used to assign the LCD I2C address diff --git a/conf/.gitignore b/conf/.gitignore new file mode 100644 index 0000000..f66c198 --- /dev/null +++ b/conf/.gitignore @@ -0,0 +1 @@ +rewrites.sed diff --git a/conf/_common/nwfmqtt.conf.in b/conf/_common/nwfmqtt.conf.in new file mode 100644 index 0000000..9aee1d9 --- /dev/null +++ b/conf/_common/nwfmqtt.conf.in @@ -0,0 +1,9 @@ +{ + "broker": "kgb.club.cc.cmu.edu", + "port": 1883, + "secure" : 0, + "clean": 1, + "keepalive": 100, + "user": "@@MQTT_USER@@", + "pass": "@@MQTT_PASSWORD@@" +} diff --git a/conf/_common/nwfnet.conf b/conf/_common/nwfnet.conf new file mode 100644 index 0000000..c9a6738 --- /dev/null +++ b/conf/_common/nwfnet.conf @@ -0,0 +1 @@ +{ "wifi_mode":"station", "sta_essid": "CMU", "sta_pw": "", "keepfile":1 } diff --git a/conf/_common/nwfnet.conf2 b/conf/_common/nwfnet.conf2 new file mode 100644 index 0000000..27752fd --- /dev/null +++ b/conf/_common/nwfnet.conf2 @@ -0,0 +1 @@ +{ "sntp": "ntp.cmu.edu" } diff --git a/conf/clr/nwfnet.conf b/conf/clr/nwfnet.conf new file mode 120000 index 0000000..396dcb2 --- /dev/null +++ b/conf/clr/nwfnet.conf @@ -0,0 +1 @@ +../_common/nwfnet.conf \ No newline at end of file diff --git a/conf/clr/nwfnet.conf2 b/conf/clr/nwfnet.conf2 new file mode 120000 index 0000000..717195b --- /dev/null +++ b/conf/clr/nwfnet.conf2 @@ -0,0 +1 @@ +../_common/nwfnet.conf2 \ No newline at end of file diff --git a/conf/red/nwfnet.conf b/conf/red/nwfnet.conf new file mode 120000 index 0000000..396dcb2 --- /dev/null +++ b/conf/red/nwfnet.conf @@ -0,0 +1 @@ +../_common/nwfnet.conf \ No newline at end of file diff --git a/conf/red/nwfnet.conf2 b/conf/red/nwfnet.conf2 new file mode 120000 index 0000000..717195b --- /dev/null +++ b/conf/red/nwfnet.conf2 @@ -0,0 +1 @@ +../_common/nwfnet.conf2 \ No newline at end of file diff --git a/conf/yel/ctfws-misc.conf b/conf/yel/ctfws-misc.conf new file mode 100644 index 0000000..7425bdc --- /dev/null +++ b/conf/yel/ctfws-misc.conf @@ -0,0 +1 @@ +{ "lcd": 63 } diff --git a/conf/yel/nwfnet.conf b/conf/yel/nwfnet.conf new file mode 120000 index 0000000..396dcb2 --- /dev/null +++ b/conf/yel/nwfnet.conf @@ -0,0 +1 @@ +../_common/nwfnet.conf \ No newline at end of file diff --git a/conf/yel/nwfnet.conf2 b/conf/yel/nwfnet.conf2 new file mode 120000 index 0000000..717195b --- /dev/null +++ b/conf/yel/nwfnet.conf2 @@ -0,0 +1 @@ +../_common/nwfnet.conf2 \ No newline at end of file diff --git a/mkspiffs.sh b/mkspiffs.sh index dc3f781..d940ccc 100755 --- a/mkspiffs.sh +++ b/mkspiffs.sh @@ -13,7 +13,15 @@ LUACROSS=${FWDIR}/luac.cross ./mklfs.sh echo import core/init.lua init.lua # Grab our configuration - for i in conf/${CONFNAME}/*; do echo import $i `basename $i`; done + if [ -r conf/${CONFNAME}/rewrites.sed ]; then + for i in conf/_common/*.conf.in; do + sed -f conf/${CONFNAME}/rewrites.sed < $i \ + > `dirname $i`/`basename $i .in` + done + elif [ ! -r conf/${CONFNAME}/nwfmqtt.conf ]; then + echo 'NO MQTT CONFIGURATION KNOWN; THIS IS UNLIKELY TO WORK!' + fi + for i in conf/${CONFNAME}/*.conf; do echo import $i `basename $i`; done # And all our Lua files for i in *.lua; do echo import $i $i; done