coss_archiving/news_check/server/configuration.py

18 lines
501 B
Python

from peewee import PostgresqlDatabase
import time
import yaml
import os
config_location = os.getenv("CONFIG_FILE")
with open(config_location, "r") as f:
config = yaml.safe_load(f)
cred = config["database"]
time.sleep(10) # wait for the vpn to connect (can't use a healthcheck because there is no depends_on)
db = PostgresqlDatabase(
cred["production_db_name"], user=cred["production_user_name"], password=cred["production_password"], host="vpn", port=5432
)
import models
models.set_db(db)