Updating different scripts related to the issue #21

This commit is contained in:
Félix Aime
2020-12-18 14:57:52 +01:00
parent 9fd360d3a5
commit ea53de887d
7 changed files with 33 additions and 27 deletions

View File

@ -40,13 +40,21 @@ class Config(object):
Write a new value in the configuration
:return: bool, operation status
"""
config = yaml.load(
open(os.path.join(self.dir, "config.yaml"), "r"), Loader=yaml.SafeLoader)
config[cat][key] = value if key != "password" else self.make_password(
value)
if cat == "network" and key == "in":
self.edit_configuration_files(value)
if cat == "network" and key in ["in", "out"]:
if re.match("^wlan[0-9]{1}$", value):
if key == "in":
self.edit_configuration_files(value)
config[cat][key] = value
else:
return False
elif cat == "backend" and key == "password":
config[cat][key] = self.make_password(value)
else:
config[cat][key] = value
with open(os.path.join(self.dir, "config.yaml"), "w") as yaml_file:
yaml_file.write(yaml.dump(config, default_flow_style=False))

View File

@ -62,7 +62,7 @@ if __name__ == '__main__':
ssl_key = "{}/{}".format(path[0], 'key.pem')
if read_config(("backend", "remote_access")):
app.run(host="0.0.0.0", debug=True, port=443,
app.run(host="0.0.0.0", port=443,
ssl_context=(ssl_cert, ssl_key))
else:
app.run(port=443, debug=True, ssl_context=(ssl_cert, ssl_key))
app.run(port=443, ssl_context=(ssl_cert, ssl_key))