fix: MySQL adds SSL configuration

This commit is contained in:
junjun
2026-03-24 10:17:49 +08:00
committed by Junjun
parent af5680a1e6
commit e5e9e535ea
7 changed files with 27 additions and 5 deletions
+3 -1
View File
@@ -121,6 +121,7 @@ class DatasourceConf(BaseModel):
mode: str = ''
timeout: int = 30
lowVersion: bool = False
ssl: bool = False
def to_dict(self):
return {
@@ -136,7 +137,8 @@ class DatasourceConf(BaseModel):
"sheets": self.sheets,
"mode": self.mode,
"timeout": self.timeout,
"lowVersion": self.lowVersion
"lowVersion": self.lowVersion,
"ssl": self.ssl
}
+2 -1
View File
@@ -155,7 +155,8 @@ def get_engine(ds: CoreDatasource, timeout: int = 0) -> Engine:
elif equals_ignore_case(ds.type, 'oracle'):
engine = create_engine(get_uri(ds), poolclass=NullPool)
elif equals_ignore_case(ds.type, 'mysql'): # mysql
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": {"require": True}}, poolclass=NullPool)
ssl_mode = {"require": True} if conf.ssl else None
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": ssl_mode}, poolclass=NullPool)
else: # ck
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout}, poolclass=NullPool)
return engine
+1
View File
@@ -144,6 +144,7 @@ async def mcp_question(session: SessionDep, chat: McpQuestion):
in_chat=False, stream=chat.stream)
# Cordys crm
@router.post("/mcp_assistant", operation_id="mcp_assistant")
async def mcp_assistant(session: SessionDep, chat: McpAssistant):
session_user = BaseUserDTO(**{
+2 -1
View File
@@ -391,7 +391,8 @@
},
"timeout": "Connection Timeout(second)",
"address": "Address",
"low_version": "Compatible with lower versions"
"low_version": "Compatible with lower versions",
"ssl": "Enable SSL"
},
"sync_fields": "Sync Fields"
},
+2 -1
View File
@@ -391,7 +391,8 @@
},
"timeout": "연결 시간 초과(초)",
"address": "주소",
"low_version": "낮은 버전 호환"
"low_version": "낮은 버전 호환",
"ssl": "SSL 활성화"
},
"sync_fields": "동기화된 테이블 구조"
},
+2 -1
View File
@@ -391,7 +391,8 @@
},
"timeout": "连接超时(秒)",
"address": "地址",
"low_version": "兼容低版本"
"low_version": "兼容低版本",
"ssl": "启用 SSL"
},
"sync_fields": "同步表结构"
},
+15
View File
@@ -117,6 +117,7 @@ const form = ref<any>({
mode: 'service_name',
timeout: 30,
lowVersion: false,
ssl: false,
})
const close = () => {
@@ -164,6 +165,10 @@ const initForm = (item: any, editTable: boolean = false) => {
configuration.lowVersion !== null && configuration.lowVersion !== undefined
? configuration.lowVersion
: true
form.value.ssl =
configuration.ssl !== null && configuration.ssl !== undefined
? configuration.ssl
: false
}
if (editTable) {
@@ -236,6 +241,7 @@ const initForm = (item: any, editTable: boolean = false) => {
mode: 'service_name',
timeout: 30,
lowVersion: false,
ssl: false,
}
}
dialogVisible.value = true
@@ -324,6 +330,7 @@ const buildConf = () => {
mode: form.value.mode,
timeout: form.value.timeout,
lowVersion: form.value.lowVersion,
ssl: form.value.ssl,
})
)
const obj = JSON.parse(JSON.stringify(form.value))
@@ -340,6 +347,7 @@ const buildConf = () => {
delete obj.mode
delete obj.timeout
delete obj.lowVersion
delete obj.ssl
return obj
}
@@ -686,6 +694,13 @@ defineExpose({
>
<el-checkbox v-model="form.lowVersion" :label="t('ds.form.low_version')" />
</el-form-item>
<el-form-item
v-if="form.type === 'mysql'"
:label="t('ds.form.ssl')"
prop="ssl"
>
<el-switch v-model="form.ssl" />
</el-form-item>
<el-form-item v-if="form.type !== 'es'" :label="t('ds.form.extra_jdbc')">
<el-input
v-model="form.extraJdbc"