Skip to content

Commit

Permalink
Don't break socket connections for postgres
Browse files Browse the repository at this point in the history
Also, use dict.get() for default values.
  • Loading branch information
sur5r committed Dec 19, 2024
1 parent cb6a9c2 commit be85f82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dbbackup/db/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@


def create_postgres_uri(self):
host = self.settings.get("HOST") or "localhost"
dbname = self.settings.get("NAME") or ""
user = quote(self.settings.get("USER") or "")
password = self.settings.get("PASSWORD") or ""
host = self.settings.get("HOST", "localhost")
dbname = self.settings.get("NAME", "")
user = quote(self.settings.get("USER", ""))
password = self.settings.get("PASSWORD", "")
password = f":{quote(password)}" if password else ""
if not user:
password = ""
Expand Down

0 comments on commit be85f82

Please sign in to comment.