mailpilot / app /pg_isready.py
Yadav122's picture
Initial deployment of MailPilot application
7a88b43
raw
history blame
592 Bytes
from os import environ as env
from urllib.parse import quote_plus
import psycopg2
config = {
"host": env.get("DATABASE_HOSTNAME"),
"port": env.get("DATABASE_PORT", 5432),
"user": env.get("DATABASE_USER", "revmigrate"),
"pass": quote_plus(env.get("DATABASE_PASSWORD", "revmigrate")),
"database": env.get("DATABASE_DB", "revmigrate_ai_agent_db"),
}
dsn = "postgresql://%(user)s:%(pass)s@%(host)s:%(port)s/%(db)s" % config
if __name__ == "__main__":
try:
db = psycopg2.connect(dsn)
except (Exception, psycopg2.DatabaseError):
exit(1)
exit(0)