mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Use env vars, fixes #62
This commit is contained in:
parent
a08bfca4c7
commit
418dc41126
10 changed files with 96 additions and 106 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import psycopg2
|
||||
import json
|
||||
import os
|
||||
from settings import DB_HOST, DB_NAME, DB_USERNAME, DB_PASSWORD
|
||||
|
||||
|
||||
connection = None
|
||||
|
|
@ -17,15 +16,11 @@ def connect():
|
|||
def create_connection():
|
||||
global connection
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
with open(os.path.join(dir_path, "../../files/database.json"), "r") as fp:
|
||||
db = json.load(fp)
|
||||
|
||||
connection = psycopg2.connect(
|
||||
host=db["host"],
|
||||
database=db["database"],
|
||||
user=db["username"],
|
||||
password=db["password"]
|
||||
host=DB_HOST,
|
||||
database=DB_NAME,
|
||||
user=DB_USERNAME,
|
||||
password=DB_PASSWORD
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue