19 lines
566 B
Python
19 lines
566 B
Python
from peewee import PostgresqlDatabase
|
|
import configparser
|
|
import time
|
|
|
|
main_config = configparser.ConfigParser()
|
|
main_config.read("/app/containerdata/config/news_fetch.config.ini")
|
|
|
|
db_config = configparser.ConfigParser()
|
|
db_config.read("/app/containerdata/config/db.config.ini")
|
|
|
|
cred = db_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["db_name"], user=cred["user_name"], password=cred["password"], host="vpn", port=5432
|
|
)
|
|
|
|
import models
|
|
models.set_db(db)
|