Skip to content

Commit

Permalink
add LOCAL_DB_SSL_VERIFY for Supporting TiDB serverless (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weaxs authored Jan 23, 2025
1 parent 8bb2a15 commit 1a6ad50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions dbgpt/_private/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def __init__(self) -> None:
self.LOCAL_DB_PASSWORD = os.getenv("LOCAL_DB_PASSWORD", "aa123456")
self.LOCAL_DB_POOL_SIZE = int(os.getenv("LOCAL_DB_POOL_SIZE", 10))
self.LOCAL_DB_POOL_OVERFLOW = int(os.getenv("LOCAL_DB_POOL_OVERFLOW", 20))
self.LOCAL_DB_SSL_VERIFY = bool(os.getenv("LOCAL_DB_SSL_VERIFY", False))

self.CHAT_HISTORY_STORE_TYPE = os.getenv("CHAT_HISTORY_STORE_TYPE", "db")

Expand Down
2 changes: 2 additions & 0 deletions dbgpt/app/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def _initialize_db(
f"{str(CFG.LOCAL_DB_PORT)}/"
f"{db_name}?charset=utf8mb4"
)
if CFG.LOCAL_DB_SSL_VERIFY:
db_url += "&ssl_verify_cert=true&ssl_verify_identity=true"
# Try to create database, if failed, will raise exception
_create_mysql_database(db_name, db_url, try_to_create_db)
elif CFG.LOCAL_DB_TYPE == DBType.OceanBase.value():
Expand Down

0 comments on commit 1a6ad50

Please sign in to comment.