-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
47 lines (36 loc) · 847 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import gc;
import json;
from utils import exists;
config = {
'ssid': ''
,'pass': ''
,'timeout_net': 30000
,'mqttserv': ''
,'mqtttopic': ''
,'mqttport': 1880
};
def config_load(): #{
global config;
print("[CONFIG] Loading...");
if (exists('config.json')): #{
f = open('config.json', 'r');
config = json.load(f);
print("[CONFIG] " + str(config));
#}
#}
def config_save(): #{
global config;
print("[CONFIG] Saving config");
f = open('config.json', 'w');
print("[CONFIG] JSON: " + str(json.dumps(config)));
f.write(str(json.dumps(config)));
f.close();
#}
def launch_app(): #{
print("\n\n");
print("[CONFIG] Config App");
gc.collect();
import web_server;
web_server.start();
#}
# vim:ts=4:tw=80:sw=4:et:ai:si