File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,25 @@ export const parseDgraphUrl = url => {
8080 const [ host , queryString ] = rest . split ( "?" ) ;
8181 const params = new URLSearchParams ( queryString || "" ) ;
8282
83- // Remove port number from host if present
84- const hostWithoutPort = host . split ( ":" ) [ 0 ] ;
83+ // Get sslmode with default as 'disable'
84+ const sslmode = params . get ( "sslmode" ) || "disable" ;
85+
86+ // Only strip port for hypermode hosts
87+ const isHypermodeHost =
88+ host . includes ( "hypermode.host" ) ||
89+ host . includes ( "hypermode-stage.host" ) ;
90+ const hostWithoutPort = isHypermodeHost ? host . split ( ":" ) [ 0 ] : host ;
91+
92+ // Use http for disable, https for others (require/verify-ca)
93+ const protocol = sslmode === "disable" ? "http" : "https" ;
94+
95+ const finalUrl = isHypermodeHost
96+ ? `${ protocol } ://${ hostWithoutPort } /dgraph`
97+ : `${ protocol } ://${ host } ` ;
8598
8699 return {
87- url : `https:// ${ hostWithoutPort } /dgraph` ,
88- sslmode : params . get ( "sslmode" ) ,
100+ url : finalUrl ,
101+ sslmode,
89102 bearertoken : params . get ( "bearertoken" ) ,
90103 } ;
91104 }
You can’t perform that action at this time.
0 commit comments