Skip to content

Commit

Permalink
add: AWS support
Browse files Browse the repository at this point in the history
  • Loading branch information
dakopen committed Jul 19, 2024
1 parent a49d7b0 commit f2fdb12
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions aussprachetrainer/aussprachetrainer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def before_send(event, hint):
IS_DOCKER_APP = os.environ.get('IS_DOCKER_APP', 'False') == 'True'
ENV = os.environ.get('ENVIRONMENT', 'production')
BETA = os.environ.get('BETA', 'False') == 'True'
USE_AWS = os.environ.get('USE_AWS', 'False') == 'True'

if DEBUG:
sentry_sdk.init(
Expand Down Expand Up @@ -159,20 +160,36 @@ def before_send(event, hint):
}
else:
if not BETA:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'defaultdb',
'USER': 'doadmin',
'PASSWORD': get_secret("DO-DATABASE-PASSWORD"),
'HOST': 'db-postgresql-fra-docker-do-user-10555764-0.c.db.ondigitalocean.com', # This should match the service name in docker-compose
'PORT': '25060',
'OPTIONS': {
'sslmode': 'require',
'sslrootcert': os.path.join(BASE_DIR, 'certificates/ca-certificate.crt'),
if not USE_AWS:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'defaultdb',
'USER': 'doadmin',
'PASSWORD': get_secret("DO-DATABASE-PASSWORD"),
'HOST': 'db-postgresql-fra-docker-do-user-10555764-0.c.db.ondigitalocean.com', # This should match the service name in docker-compose
'PORT': '25060',
'OPTIONS': {
'sslmode': 'require',
'sslrootcert': os.path.join(BASE_DIR, 'certificates/ca-certificate.crt'),
}
}
}
else: # USE_AWS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'dbmasteruser',
'PASSWORD': get_secret("AWS-AusspracheTrainer-org-Database"),
'HOST': 'ls-fcab045a8d248bddd326ff19f38620925e35807a.cfmiweyqykva.eu-central-1.rds.amazonaws.com', # This should match the service name in docker-compose
'PORT': '5432',
#'OPTIONS': {
# 'sslmode': 'require',
# 'sslrootcert': os.path.join(BASE_DIR, 'certificates/ca-certificate.crt'),
#}
}
}
}

else: # BETA
DATABASES = {
Expand Down

0 comments on commit f2fdb12

Please sign in to comment.