Browse Source

remove ssl (#203)

* remove ssl

Signed-off-by: shanghaikid <jiangruiyi@gmail.com>

* make sure attu server working after connection failed.

Signed-off-by: shanghaikid <jiangruiyi@gmail.com>

---------

Signed-off-by: shanghaikid <jiangruiyi@gmail.com>
ryjiang 2 years ago
parent
commit
6da151713c

+ 0 - 1
client/src/http/Milvus.ts

@@ -20,7 +20,6 @@ export class MilvusHttp extends BaseModel {
     address: string;
     username?: string;
     password?: string;
-    ssl?: boolean;
   }) {
     return super.create({ path: this.CONNECT_URL, data });
   }

+ 0 - 1
client/src/i18n/cn/common.ts

@@ -10,7 +10,6 @@ const commonTrans = {
     prometheusAddress: 'Prometheus Address',
     prometheusInstance: 'Prometheus Instance',
     prometheusNamespace: 'Prometheus Namespace',
-    ssl: 'SSL',
   },
   status: {
     loaded: 'loaded',

+ 0 - 1
client/src/i18n/en/common.ts

@@ -10,7 +10,6 @@ const commonTrans = {
     prometheusAddress: 'Prometheus Address',
     prometheusInstance: 'Prometheus Instance',
     prometheusNamespace: 'Prometheus Namespace',
-    ssl: 'SSL',
   },
   status: {
     loaded: 'loaded',

+ 1 - 7
client/src/pages/connect/AuthForm.tsx

@@ -81,7 +81,7 @@ export const AuthForm = (props: any) => {
   const { validation, checkIsValid } = useFormValidation(checkedForm);
 
   const handleInputChange = (
-    key: 'address' | 'username' | 'password' | 'ssl',
+    key: 'address' | 'username' | 'password',
     value: string | boolean
   ) => {
     setForm(v => ({ ...v, [key]: value }));
@@ -229,12 +229,6 @@ export const AuthForm = (props: any) => {
             key={v.label}
           />
         ))}
-        <div className={classes.sslWrapper}>
-          <CustomRadio
-            label={attuTrans.ssl}
-            handleChange={(val: boolean) => handleInputChange('ssl', val)}
-          />
-        </div>
         <div className={classes.sslWrapper}>
           <CustomRadio
             defaultChecked={withPrometheus}

+ 2 - 2
server/src/milvus/milvus.controller.ts

@@ -38,11 +38,11 @@ export class MilvusController {
   }
 
   async connectMilvus(req: Request, res: Response, next: NextFunction) {
-    const { address, username, password, ssl } = req.body;
+    const { address, username, password } = req.body;
     const insightCache = req.app.get(INSIGHT_CACHE);
     try {
       const result = await this.milvusService.connectMilvus(
-        { address, username, password, ssl },
+        { address, username, password },
         insightCache
       );
 

+ 7 - 4
server/src/milvus/milvus.service.ts

@@ -44,11 +44,10 @@ export class MilvusService {
       address: string;
       username?: string;
       password?: string;
-      ssl?: boolean;
     },
     cache: LruCache<any, any>
   ) {
-    const { address, username, password, ssl = false } = data;
+    const { address, username, password } = data;
     // grpc only need address without http
     const milvusAddress = MilvusService.formatAddress(address);
     const hasAuth = username !== undefined && password !== undefined;
@@ -57,11 +56,15 @@ export class MilvusService {
       const milvusClient: MilvusClient = hasAuth
         ? new MilvusClient({
             address: milvusAddress,
-            ssl,
             username,
             password,
           })
-        : new MilvusClient({ address, ssl });
+        : new MilvusClient({ address });
+
+      // don't break attu
+      await milvusClient.connectPromise.catch(error => {
+        throw HttpErrors(HTTP_STATUS_CODE.BAD_REQUEST, error);
+      });
 
       // check healthy
       const res = await milvusClient.checkHealth();