Fixed process of updating app on running instances
All checks were successful
AWS Deploy on Push / build (push) Successful in 1m29s
All checks were successful
AWS Deploy on Push / build (push) Successful in 1m29s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import boto3
|
||||
from .constants import AWS_REGION
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
@@ -7,8 +8,14 @@ from functools import lru_cache
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def get_db_credentials():
|
||||
"""Fetch and cache DB credentials from SSM Parameter Store"""
|
||||
ssm = boto3.client('ssm')
|
||||
"""Fetch and cache DB credentials from environment or SSM Parameter Store"""
|
||||
if os.getenv("MOCK_AUTH", "").lower() == "true":
|
||||
return (
|
||||
f"postgresql://{os.getenv('DB_USER')}:{os.getenv('DB_PASSWORD')}"
|
||||
f"@{os.getenv('DB_HOST')}/{os.getenv('DB_NAME')}"
|
||||
)
|
||||
|
||||
ssm = boto3.client('ssm', region_name=AWS_REGION)
|
||||
try:
|
||||
host = ssm.get_parameter(Name='/iptv-updater/DB_HOST', WithDecryption=True)['Parameter']['Value']
|
||||
user = ssm.get_parameter(Name='/iptv-updater/DB_USER', WithDecryption=True)['Parameter']['Value']
|
||||
|
||||
Reference in New Issue
Block a user