mirror of https://github.com/nocodb/nocodb
Browse Source
* fix: handle invalid ssl value in GUI * fix: handle invalid ssl value in backend and move logic to sdkpull/9074/head
Pranav C
4 months ago
committed by
GitHub
13 changed files with 100 additions and 63 deletions
@ -0,0 +1,33 @@ |
|||||||
|
import { SSLUsage } from '~/lib/enums'; |
||||||
|
|
||||||
|
export const validateAndExtractSSLProp = ( |
||||||
|
connectionConfig: any, |
||||||
|
sslUse: SSLUsage = SSLUsage.No, |
||||||
|
client: string |
||||||
|
) => { |
||||||
|
if ('ssl' in connectionConfig && connectionConfig.ssl) { |
||||||
|
if ( |
||||||
|
sslUse === SSLUsage.No || |
||||||
|
(typeof connectionConfig.ssl === 'object' && |
||||||
|
Object.values(connectionConfig.ssl).every( |
||||||
|
(v) => v === null || v === undefined |
||||||
|
)) |
||||||
|
) { |
||||||
|
return undefined; |
||||||
|
} |
||||||
|
// if postgres then only allow boolean or object
|
||||||
|
else if ( |
||||||
|
client === 'pg' && |
||||||
|
['true', 'false'].includes(connectionConfig.ssl) |
||||||
|
) { |
||||||
|
return connectionConfig.ssl === 'true'; |
||||||
|
} else if ( |
||||||
|
client === 'pg' && |
||||||
|
!['boolean', 'object'].includes(typeof connectionConfig.ssl) |
||||||
|
) { |
||||||
|
return undefined; |
||||||
|
} |
||||||
|
|
||||||
|
return connectionConfig.ssl; |
||||||
|
} |
||||||
|
}; |
Loading…
Reference in new issue