Commit 3f80cf81 authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Move database password to config file.

parent d37b926f
...@@ -2,11 +2,13 @@ import pymysql ...@@ -2,11 +2,13 @@ import pymysql
class DB(): class DB():
def __init__(self): def __init__(self):
pass with open("/etc/lysns/db-pass", "r") as f:
self.pw = f.readline().strip()
def __enter__(self): def __enter__(self):
self.connection = pymysql.connect(host='lysns.lysator.liu.se', self.connection = pymysql.connect(host='lysns.lysator.liu.se',
user='lysns', user='lysns',
password='hunter2', password=self.pw,
db='lysns', db='lysns',
charset='utf8mb4', charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor) cursorclass=pymysql.cursors.DictCursor)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment