Skip to content

Commit

Permalink
Encode credentials for db uri
Browse files Browse the repository at this point in the history
  • Loading branch information
zechmeister committed Mar 1, 2024
1 parent 6bf8a80 commit 90d93a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions query_and_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import requests
import subprocess
import yaml

import urllib.parse

def read_secret_file(key):
try:
Expand All @@ -24,8 +24,8 @@ def read_secret_file(key):
os.environ.get("DBURI")
if "DBURI" in os.environ
else (
f"postgresql://{read_secret_file(config['db']['user-secret-file'])}"
f":{read_secret_file(config['db']['password-secret-file'])}"
f"postgresql://{urllib.parse.quote(read_secret_file(config['db']['user-secret-file']))}"
f":{urllib.parse.quote(read_secret_file(config['db']['password-secret-file']))}"
f"@{config['db']['host']}"
f":{config['db']['port']}"
f"/{config['db']['name']}"
Expand Down

0 comments on commit 90d93a7

Please sign in to comment.