-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigurations.py
More file actions
30 lines (24 loc) · 893 Bytes
/
configurations.py
File metadata and controls
30 lines (24 loc) · 893 Bytes
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
import configparser
import platform
HOSTNAME = platform.node()
config_machines = configparser.ConfigParser()
config_machines.read("./config/config_machines.ini")
def get_config_file():
config = configparser.ConfigParser()
if config_machines["MACHINES"][HOSTNAME] == "local":
config.read("./config/config_local.ini")
elif config_machines["MACHINES"][HOSTNAME] == "remote":
config.read("./config/config_remote.ini")
elif config_machines["MACHINES"][HOSTNAME] == "pi":
config.read("./config/config_pi.ini")
else:
config.read("./config/config_local.ini")
return config
def get_secrets_file():
config = configparser.ConfigParser()
try:
config.read("./config/auth_lemonde.ini")
except:
config = {"auth": {"username": "", "password": ""}}
print("Valid authentication file not found")
return config