Skip to content

Commit

Permalink
Putting replace call after DB URI load from vcap services
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-moore-97 committed Nov 17, 2023
1 parent d4ee434 commit 21f6954
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions gdrive/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
if vcap_services:
user_services = json.loads(vcap_services)["user-provided"]
DB_URI = json.loads(vcap_services)["aws-rds"][0]["credentials"]["uri"]

# Sqlalchemy requires 'postgresql' as the protocol
DB_URI = DB_URI.replace("postgres://", "postgresql://", 1)
for service in user_services:
if service["name"] == "gdrive":
log.info("Loading credentials from env var")
Expand All @@ -67,8 +68,3 @@
except (json.JSONDecodeError, KeyError, FileNotFoundError) as err:
log.warning("Unable to load credentials from VCAP_SERVICES")
log.debug("Error: %s", str(err))


if DB_URI is not None:
# Sqlalchemy requires 'postgresql' as the protocol
DB_URI = DB_URI.replace("postgres://", "postgresql://", 1)

0 comments on commit 21f6954

Please sign in to comment.