Skip to content

Commit

Permalink
fix: remove postgresql default charset config (langgenius#1720)
Browse files Browse the repository at this point in the history
  • Loading branch information
takatost authored Dec 8, 2023
1 parent 13f2c90 commit bee0d12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'))
Expand Down

0 comments on commit bee0d12

Please sign in to comment.