Make sure that secrets would work on aws
This commit is contained in:
parent
fa1df60d5d
commit
523f893c5b
1 changed files with 24 additions and 7 deletions
|
|
@ -9,9 +9,9 @@ from postgres.models import operation
|
||||||
from postgres.models import sessions
|
from postgres.models import sessions
|
||||||
from postgres.models import user
|
from postgres.models import user
|
||||||
from postgres.models import docs
|
from postgres.models import docs
|
||||||
from cognitive_architecture.config import Config
|
# from cognitive_architecture.config import Config
|
||||||
config = Config()
|
# config = Config()
|
||||||
config.load()
|
# config.load()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24,8 +24,25 @@ load_dotenv()
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
if os.environ.get('AWS_ENV') == 'prd' or os.environ.get('AWS_ENV') == 'dev':
|
||||||
|
host = os.environ.get('POSTGRES_HOST')
|
||||||
|
username = os.environ.get('POSTGRES_USER')
|
||||||
|
password = os.environ.get('POSTGRES_PASSWORD')
|
||||||
|
database_name = os.environ.get('POSTGRES_DB')
|
||||||
|
elif os.environ.get('AWS_ENV') == 'local':
|
||||||
|
host = os.environ.get('POSTGRES_HOST')
|
||||||
|
username = os.environ.get('POSTGRES_USER')
|
||||||
|
password = os.environ.get('POSTGRES_PASSWORD')
|
||||||
|
database_name = os.environ.get('POSTGRES_DB')
|
||||||
|
else:
|
||||||
|
host = os.environ.get('POSTGRES_HOST')
|
||||||
|
username = os.environ.get('POSTGRES_USER')
|
||||||
|
password = os.environ.get('POSTGRES_PASSWORD')
|
||||||
|
database_name = os.environ.get('POSTGRES_DB')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_admin_engine(username, password, host, database_name):
|
def create_admin_engine(username, password, host, database_name):
|
||||||
|
|
@ -63,10 +80,10 @@ if __name__ == "__main__":
|
||||||
# password = os.getenv('POSTGRES_PASSWORD')
|
# password = os.getenv('POSTGRES_PASSWORD')
|
||||||
# database_name = os.getenv('POSTGRES_DB')
|
# database_name = os.getenv('POSTGRES_DB')
|
||||||
# environment = os.environ.get("ENV")
|
# environment = os.environ.get("ENV")
|
||||||
host = config.postgres_host
|
# host = config.postgres_host
|
||||||
username = config.postgres_user
|
# username = config.postgres_user
|
||||||
password = config.postgres_password
|
# password = config.postgres_password
|
||||||
database_name = config.postgres_db
|
# database_name = config.postgres_db
|
||||||
|
|
||||||
engine = create_admin_engine(username, password, host, database_name)
|
engine = create_admin_engine(username, password, host, database_name)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue