make password configs be in a different file, don't publish passwords in git

This commit is contained in:
Maff 2018-06-02 00:23:08 +01:00
parent 3a17e7f218
commit 2f8c2ef767
4 changed files with 12 additions and 8 deletions

2
.gitignore vendored
View File

@ -96,3 +96,5 @@ ENV/
.idea/
.vscode/
/wifi_cfg.py
/webrepl_cfg.py

14
boot.py
View File

@ -1,5 +1,6 @@
from network import WLAN as wlan, STA_IF as staif, AP_IF as apif
from time import sleep_ms
from wifi_cfg import wlan_nets
sleep_ms(100)
#make sure AP mode is off and station mode is on
@ -15,14 +16,11 @@ if wlan(staif).isconnected() != True:
nets=wlan(staif).scan()
found_net=False
for net in nets:
if net[0] == b'WiFiNetworkName':
wlan(staif).connect("WiFiNetworkName","WiFiNetworkPSK")
found_net=True
break
elif net[0] == b'WiFiNetworkName':
wlan(staif).connect("WiFiNetworkName","WiFiNetworkPSK")
found_net=True
break
for cfg_net in wlan_nets.keys():
if net[0] == b'%s' % cfg_net:
wlan(staif).connect(cfg_net, wlan_nets[cfg_net])
found_net=True
break
if found_net == False:
print("couldn't connect to wifi, nets found: %s" % nets)
print("to fix temporarily, run: wlan(staif).connect('yournet','yourpass'), followed shortly after by wlan(staif).ifconfig()")

1
webrepl_cfg.sample.py Normal file
View File

@ -0,0 +1 @@
PASS='MyWebREPLPassword'

3
wifi_cfg.sample.py Normal file
View File

@ -0,0 +1,3 @@
wlan_nets={
'YourNetwork': 'YourPSK',
}