Skip to content

Commit e5e9e53

Browse files
committed
fix: MySQL adds SSL configuration
1 parent af5680a commit e5e9e53

File tree

7 files changed

+27
-5
lines changed

7 files changed

+27
-5
lines changed

backend/apps/datasource/models/datasource.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class DatasourceConf(BaseModel):
121121
mode: str = ''
122122
timeout: int = 30
123123
lowVersion: bool = False
124+
ssl: bool = False
124125

125126
def to_dict(self):
126127
return {
@@ -136,7 +137,8 @@ def to_dict(self):
136137
"sheets": self.sheets,
137138
"mode": self.mode,
138139
"timeout": self.timeout,
139-
"lowVersion": self.lowVersion
140+
"lowVersion": self.lowVersion,
141+
"ssl": self.ssl
140142
}
141143

142144

backend/apps/db/db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ def get_engine(ds: CoreDatasource, timeout: int = 0) -> Engine:
155155
elif equals_ignore_case(ds.type, 'oracle'):
156156
engine = create_engine(get_uri(ds), poolclass=NullPool)
157157
elif equals_ignore_case(ds.type, 'mysql'): # mysql
158-
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": {"require": True}}, poolclass=NullPool)
158+
ssl_mode = {"require": True} if conf.ssl else None
159+
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": ssl_mode}, poolclass=NullPool)
159160
else: # ck
160161
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout}, poolclass=NullPool)
161162
return engine

backend/apps/mcp/mcp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ async def mcp_question(session: SessionDep, chat: McpQuestion):
144144
in_chat=False, stream=chat.stream)
145145

146146

147+
# Cordys crm
147148
@router.post("/mcp_assistant", operation_id="mcp_assistant")
148149
async def mcp_assistant(session: SessionDep, chat: McpAssistant):
149150
session_user = BaseUserDTO(**{

frontend/src/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@
391391
},
392392
"timeout": "Connection Timeout(second)",
393393
"address": "Address",
394-
"low_version": "Compatible with lower versions"
394+
"low_version": "Compatible with lower versions",
395+
"ssl": "Enable SSL"
395396
},
396397
"sync_fields": "Sync Fields"
397398
},

frontend/src/i18n/ko-KR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@
391391
},
392392
"timeout": "연결 시간 초과(초)",
393393
"address": "주소",
394-
"low_version": "낮은 버전 호환"
394+
"low_version": "낮은 버전 호환",
395+
"ssl": "SSL 활성화"
395396
},
396397
"sync_fields": "동기화된 테이블 구조"
397398
},

frontend/src/i18n/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@
391391
},
392392
"timeout": "连接超时(秒)",
393393
"address": "地址",
394-
"low_version": "兼容低版本"
394+
"low_version": "兼容低版本",
395+
"ssl": "启用 SSL"
395396
},
396397
"sync_fields": "同步表结构"
397398
},

frontend/src/views/ds/DatasourceForm.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const form = ref<any>({
117117
mode: 'service_name',
118118
timeout: 30,
119119
lowVersion: false,
120+
ssl: false,
120121
})
121122
122123
const close = () => {
@@ -164,6 +165,10 @@ const initForm = (item: any, editTable: boolean = false) => {
164165
configuration.lowVersion !== null && configuration.lowVersion !== undefined
165166
? configuration.lowVersion
166167
: true
168+
form.value.ssl =
169+
configuration.ssl !== null && configuration.ssl !== undefined
170+
? configuration.ssl
171+
: false
167172
}
168173
169174
if (editTable) {
@@ -236,6 +241,7 @@ const initForm = (item: any, editTable: boolean = false) => {
236241
mode: 'service_name',
237242
timeout: 30,
238243
lowVersion: false,
244+
ssl: false,
239245
}
240246
}
241247
dialogVisible.value = true
@@ -324,6 +330,7 @@ const buildConf = () => {
324330
mode: form.value.mode,
325331
timeout: form.value.timeout,
326332
lowVersion: form.value.lowVersion,
333+
ssl: form.value.ssl,
327334
})
328335
)
329336
const obj = JSON.parse(JSON.stringify(form.value))
@@ -340,6 +347,7 @@ const buildConf = () => {
340347
delete obj.mode
341348
delete obj.timeout
342349
delete obj.lowVersion
350+
delete obj.ssl
343351
return obj
344352
}
345353
@@ -686,6 +694,13 @@ defineExpose({
686694
>
687695
<el-checkbox v-model="form.lowVersion" :label="t('ds.form.low_version')" />
688696
</el-form-item>
697+
<el-form-item
698+
v-if="form.type === 'mysql'"
699+
:label="t('ds.form.ssl')"
700+
prop="ssl"
701+
>
702+
<el-switch v-model="form.ssl" />
703+
</el-form-item>
689704
<el-form-item v-if="form.type !== 'es'" :label="t('ds.form.extra_jdbc')">
690705
<el-input
691706
v-model="form.extraJdbc"

0 commit comments

Comments
 (0)