aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-06-18 14:12:08 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-06-18 14:12:08 +0200
commit8a398cfa8fed0369cd0fc42b16f1bd8bc6bfa7b4 (patch)
tree285e2029b1592c6b7dcec7561b606b1fa5ff29e0 /src
parent2c86df3c3216bffecd3ed5a702fbc64e4549e194 (diff)
download0tdns-8a398cfa8fed0369cd0fc42b16f1bd8bc6bfa7b4.tar.gz
0tdns-8a398cfa8fed0369cd0fc42b16f1bd8bc6bfa7b4.zip
remove add_config.py
Diffstat (limited to 'src')
-rwxr-xr-xsrc/add_config.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/add_config.py b/src/add_config.py
deleted file mode 100755
index 4fd4feb..0000000
--- a/src/add_config.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/python3
-
-from sys import argv
-import yaml
-import psycopg2
-import hashlib
-
-db_config_path = '/etc/0tdns/db_connection_config.yml'
-
-ovpn_config_path = argv[1]
-
-with open(ovpn_config_path) as file:
- ovpn_config_text = file.read()
-
-ovpn_config_raw = bytearray(ovpn_config_text, encoding='utf-8')
-
-ovpn_config_hash = hashlib.sha256(ovpn_config_raw).hexdigest()
-
-config = yaml.safe_load(open(db_config_path, 'r'))
-connection = psycopg2.connect(user=config['user'], password=config['password'],
- host=config['host'], port=config['port'],
- database=config['database'])
-cursor = connection.cursor()
-
-cursor.execute('''
-INSERT INTO vpn (location_id, ovpn_config, ovpn_config_sha256)
-VALUES(%s, %s, %s)''', (11, ovpn_config_text, ovpn_config_hash))
-
-connection.commit()
-cursor.close()
-connection.close()