File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ func DB(config *engine.PluginConfig) (*mongo.Client, error) {
14
14
ctx := context .Background ()
15
15
port := common .GetRecordValueOrDefault (config .Credentials .Advanced , "Port" , "27017" )
16
16
queryParams := common .GetRecordValueOrDefault (config .Credentials .Advanced , "URL Params" , "" )
17
+ dnsEnabled := common .GetRecordValueOrDefault (config .Credentials .Advanced , "DNS Enabled" , "false" )
17
18
var connectionString string
18
- // TODO: add TLS enabled logic to work instead of hard coded domains
19
- if config .Credentials .Hostname == "localhost" || config .Credentials .Hostname == "host.docker.internal" {
19
+ if dnsEnabled == "false" {
20
20
connectionString = fmt .Sprintf ("mongodb://%s:%s@%s:%s/%s%s" ,
21
21
config .Credentials .Username ,
22
22
config .Credentials .Password ,
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ const databaseTypeDropdownItems: IDropdownItem<Record<string, string>>[] = [
45
45
id : "MongoDB" ,
46
46
label : "MongoDB" ,
47
47
icon : Icons . Logos . MongoDB ,
48
- extra : { "Port" : "27017" , "URL Params" : "?" } ,
48
+ extra : { "Port" : "27017" , "URL Params" : "?" , "DNS Enabled" : "false" } ,
49
49
} ,
50
50
{
51
51
id : "Redis" ,
@@ -168,10 +168,13 @@ export const LoginPage: FC = () => {
168
168
setUsername ( url . username ) ;
169
169
setPassword ( url . password ) ;
170
170
setDatabase ( url . pathname . substring ( 1 ) ) ;
171
- setAdvancedForm ( { "Port" : url . port . length > 0 ? url . port : "80" , "URL Params" : `?${ url . searchParams . toString ( ) } ` } ) ;
172
- if ( url . port != null || url . searchParams . size !== 0 ) {
173
- setShowAdvanced ( true ) ;
171
+ const advancedForm = { "Port" : "27017" , "URL Params" : `?${ url . searchParams . toString ( ) } ` , "DNS Enabled" : "false" } ;
172
+ if ( url . port . length === 0 ) {
173
+ advancedForm [ "Port" ] = "" ;
174
+ advancedForm [ "DNS Enabled" ] = "true" ;
174
175
}
176
+ setAdvancedForm ( advancedForm ) ;
177
+ setShowAdvanced ( true ) ;
175
178
} , [ databaseType . id ] ) ;
176
179
177
180
const fields = useMemo ( ( ) => {
You can’t perform that action at this time.
0 commit comments