diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index 91df1fe87..e98c6ead6 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -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"