diff --git a/lib.py b/lib.py
index c8194e8..71b2ecd 100755
--- a/lib.py
+++ b/lib.py
@@ -33,10 +33,19 @@ def get_config():
try:
with open(args.config, "r") as file:
config = yaml.safe_load(file)
+ if config == None:
+ config = {
+ "servers": {},
+ "clients": {}
+ }
except:
try:
with open(args.config, "w"):
- pass
+ config = {
+ "servers": {},
+ "clients": {}
+ }
+ yaml.safe_dump(config, file)
except Exception as exp:
log.error(f"Couldn't create config. {exp}")
return None
diff --git a/templates/index.html b/templates/index.html
index 3628a0e..0124b20 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -7,10 +7,10 @@
Servers
{% for server in SERVERS %}
- {% set list_ns = namespace(total_bytes=0) %}
+ {% set total_traffic = namespace(total_bytes=0) %}
{% for key in server.data["keys"] %}
{% if key.used_bytes %}
- {% set list_ns.total_bytes = list_ns.total_bytes + key.used_bytes %}
+ {% set total_traffic.total_bytes = total_traffic.total_bytes + key.used_bytes %}
{% endif %}
{% endfor %}
@@ -19,7 +19,7 @@
{{ '/'.join(server.info()["url"].split('/')[0:-1]) }}
Port {{ server.info()["port_for_new_access_keys"] }}
Hostname {{ server.info()["hostname_for_access_keys"] }}
- Traffic: {{ list_ns.total_bytes | filesizeformat }}
+ Traffic: {{ total_traffic.total_bytes | filesizeformat }}
v.{{ server.info()["version"] }}