feat: introduce pydantic-settings for config definition and validation (#5202)
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -6,15 +6,15 @@ redis_client = redis.Redis()
|
||||
|
||||
def init_app(app):
|
||||
connection_class = Connection
|
||||
if app.config.get('REDIS_USE_SSL', False):
|
||||
if app.config.get('REDIS_USE_SSL'):
|
||||
connection_class = SSLConnection
|
||||
|
||||
redis_client.connection_pool = redis.ConnectionPool(**{
|
||||
'host': app.config.get('REDIS_HOST', 'localhost'),
|
||||
'port': app.config.get('REDIS_PORT', 6379),
|
||||
'username': app.config.get('REDIS_USERNAME', None),
|
||||
'password': app.config.get('REDIS_PASSWORD', None),
|
||||
'db': app.config.get('REDIS_DB', 0),
|
||||
'host': app.config.get('REDIS_HOST'),
|
||||
'port': app.config.get('REDIS_PORT'),
|
||||
'username': app.config.get('REDIS_USERNAME'),
|
||||
'password': app.config.get('REDIS_PASSWORD'),
|
||||
'db': app.config.get('REDIS_DB'),
|
||||
'encoding': 'utf-8',
|
||||
'encoding_errors': 'strict',
|
||||
'decode_responses': False
|
||||
|
Reference in New Issue
Block a user