File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ The following environment variables are required to run the application:
43
43
- ` RAG_OPENAI_BASEURL ` : (Optional) The base URL for your OpenAI API Embeddings
44
44
- ` RAG_OPENAI_PROXY ` : (Optional) Proxy for OpenAI API Embeddings
45
45
- ` VECTOR_DB_TYPE ` : (Optional) select vector database type, default to ` pgvector ` .
46
+ - ` POSTGRES_USE_UNIX_SOCKET ` : (Optional) Set to "True" when connecting to the PostgreSQL database server with Unix Socket.
46
47
- ` POSTGRES_DB ` : (Optional) The name of the PostgreSQL database, used when ` VECTOR_DB_TYPE=pgvector ` .
47
48
- ` POSTGRES_USER ` : (Optional) The username for connecting to the PostgreSQL database.
48
49
- ` POSTGRES_PASSWORD ` : (Optional) The password for connecting to the PostgreSQL database.
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ def get_env_variable(
50
50
VECTOR_DB_TYPE = VectorDBType (
51
51
get_env_variable ("VECTOR_DB_TYPE" , VectorDBType .PGVECTOR .value )
52
52
)
53
+ POSTGRES_USE_UNIX_SOCKET = (
54
+ get_env_variable ("POSTGRES_USE_UNIX_SOCKET" , "False" ).lower () == "true"
55
+ )
53
56
POSTGRES_DB = get_env_variable ("POSTGRES_DB" , "mydatabase" )
54
57
POSTGRES_USER = get_env_variable ("POSTGRES_USER" , "myuser" )
55
58
POSTGRES_PASSWORD = get_env_variable ("POSTGRES_PASSWORD" , "mypassword" )
@@ -69,8 +72,13 @@ def get_env_variable(
69
72
env_value = get_env_variable ("PDF_EXTRACT_IMAGES" , "False" ).lower ()
70
73
PDF_EXTRACT_IMAGES = True if env_value == "true" else False
71
74
72
- CONNECTION_STRING = f"postgresql+psycopg2://{ urllib .parse .quote_plus (POSTGRES_USER )} :{ urllib .parse .quote_plus (POSTGRES_PASSWORD )} @{ DB_HOST } :{ DB_PORT } /{ urllib .parse .quote_plus (POSTGRES_DB )} "
73
- DSN = f"postgresql://{ urllib .parse .quote_plus (POSTGRES_USER )} :{ urllib .parse .quote_plus (POSTGRES_PASSWORD )} @{ DB_HOST } :{ DB_PORT } /{ urllib .parse .quote_plus (POSTGRES_DB )} "
75
+ if POSTGRES_USE_UNIX_SOCKET :
76
+ connection_suffix = f"{ urllib .parse .quote_plus (POSTGRES_USER )} :{ urllib .parse .quote_plus (POSTGRES_PASSWORD )} @/{ urllib .parse .quote_plus (POSTGRES_DB )} ?host={ urllib .parse .quote_plus (DB_HOST )} "
77
+ else :
78
+ connection_suffix = f"{ urllib .parse .quote_plus (POSTGRES_USER )} :{ urllib .parse .quote_plus (POSTGRES_PASSWORD )} @{ DB_HOST } :{ DB_PORT } /{ urllib .parse .quote_plus (POSTGRES_DB )} "
79
+
80
+ CONNECTION_STRING = f"postgresql+psycopg2://{ connection_suffix } "
81
+ DSN = f"postgresql://{ connection_suffix } "
74
82
75
83
## Logging
76
84
You can’t perform that action at this time.
0 commit comments