From bee0d124551b0c6a881abf4cecb461ed10ac7512 Mon Sep 17 00:00:00 2001 From: takatost Date: Fri, 8 Dec 2023 13:22:04 +0800 Subject: [PATCH] fix: remove postgresql default charset config (#1720) --- api/config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/config.py b/api/config.py index c67a570812fd26..cdf1ac066ea49c 100644 --- a/api/config.py +++ b/api/config.py @@ -15,7 +15,7 @@ 'DB_HOST': 'localhost', 'DB_PORT': '5432', 'DB_DATABASE': 'dify', - 'DB_CHARSET': 'utf8mb4', + 'DB_CHARSET': '', 'REDIS_HOST': 'localhost', 'REDIS_PORT': '6379', 'REDIS_DB': '0', @@ -152,7 +152,9 @@ def __init__(self): ['DB_USERNAME', 'DB_PASSWORD', 'DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_CHARSET'] } - self.SQLALCHEMY_DATABASE_URI = f"postgresql://{db_credentials['DB_USERNAME']}:{db_credentials['DB_PASSWORD']}@{db_credentials['DB_HOST']}:{db_credentials['DB_PORT']}/{db_credentials['DB_DATABASE']}?client_encoding={db_credentials['DB_CHARSET']}" + db_extras = f"?client_encoding={db_credentials['DB_CHARSET']}" if db_credentials['DB_CHARSET'] else "" + + self.SQLALCHEMY_DATABASE_URI = f"postgresql://{db_credentials['DB_USERNAME']}:{db_credentials['DB_PASSWORD']}@{db_credentials['DB_HOST']}:{db_credentials['DB_PORT']}/{db_credentials['DB_DATABASE']}{db_extras}" self.SQLALCHEMY_ENGINE_OPTIONS = { 'pool_size': int(get_env('SQLALCHEMY_POOL_SIZE')), 'pool_recycle': int(get_env('SQLALCHEMY_POOL_RECYCLE'))