aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db_connection_config.yml3
-rwxr-xr-xsrc/hourly.py4
2 files changed, 4 insertions, 3 deletions
diff --git a/db_connection_config.yml b/db_connection_config.yml
index abe2500..5e23380 100644
--- a/db_connection_config.yml
+++ b/db_connection_config.yml
@@ -3,4 +3,5 @@ password: postgres
host: "127.0.0.1"
port: "5432"
database: "ztdns"
-enabled: no \ No newline at end of file
+enabled: no
+handled_vpns: [1, 2] \ No newline at end of file
diff --git a/src/hourly.py b/src/hourly.py
index 2c87bee..7396bc2 100755
--- a/src/hourly.py
+++ b/src/hourly.py
@@ -50,7 +50,7 @@ hour = strftime('%Y-%m-%d %H:00', gmtime())
vpns = get_vpn_connections(cursor, hour)
-for vpn_id, config_hash in vpns:
+for vpn_id, config_hash in vpns if vpn_id in ztdns_config['handled_vpns']:
config_path = "/var/lib/0tdns/{}.ovpn".format(config_hash)
if not path.isfile(config_path):
sync_ovpn_config(cursor, vpn_id, config_path, config_hash)
@@ -58,7 +58,7 @@ for vpn_id, config_hash in vpns:
cursor.close()
connection.close()
-for vpn_id, config_hash in vpns:
+for vpn_id, config_hash in vpns if vpn_id in ztdns_config['handled_vpns']:
config_path = "/var/lib/0tdns/{}.ovpn".format(config_hash)
physical_ip = get_default_host_address(ztdns_config['database'])
route_through_veth = ztdns_config['database'] + "/32"