Skip to content

Commit

Permalink
Ignore the port if it already exists in the host. (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn authored Jun 5, 2024
1 parent 8c605e9 commit 8f3fa02
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/src/appointment/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ def normalize_secrets():
if database_secrets:
secrets = json.loads(database_secrets)

host = secrets['host']
port = secrets['port']

# If port is not already in the host var, then append it to hostname
hostname = host
if f':{port}' not in host:
hostname = f'{hostname}:{port}'

os.environ[
"DATABASE_URL"
] = f"mysql+mysqldb://{secrets['username']}:{secrets['password']}@{secrets['host']}:{secrets['port']}/appointment"
] = f"mysql+mysqldb://{secrets['username']}:{secrets['password']}@{hostname}/appointment"

database_enc_secret = os.getenv("DB_ENC_SECRET")

Expand Down

0 comments on commit 8f3fa02

Please sign in to comment.