fix(config): password auth to be url-encoded to avoid some deployment errors (#1422)

This commit is contained in:
Davy Peter Braun 2024-05-11 19:29:51 +02:00 committed by GitHub
parent a467999984
commit 20a22e2bc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
import os
import urllib.parse
from danswer.configs.constants import AuthType
from danswer.configs.constants import DocumentIndexType
@ -117,7 +118,10 @@ except ValueError:
# Below are intended to match the env variables names used by the official postgres docker image
# https://hub.docker.com/_/postgres
POSTGRES_USER = os.environ.get("POSTGRES_USER") or "postgres"
POSTGRES_PASSWORD = os.environ.get("POSTGRES_PASSWORD") or "password"
# URL-encode the password for asyncpg to avoid issues with special characters on some machines.
POSTGRES_PASSWORD = urllib.parse.quote_plus(
os.environ.get("POSTGRES_PASSWORD") or "password"
)
POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost"
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432"
POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres"