@@ -20,6 +20,7 @@ import (
2020var (
2121 connectorName = "baton-databricks"
2222 version = "dev"
23+ defaultHost = "cloud.databricks.com"
2324)
2425
2526func main () {
@@ -58,7 +59,7 @@ func prepareClientAuth(ctx context.Context, cfg *viper.Viper) databricks.Auth {
5859 password := cfg .GetString (config .PasswordField .FieldName )
5960 workspaces := cfg .GetStringSlice (config .WorkspacesField .FieldName )
6061 tokens := cfg .GetStringSlice (config .TokensField .FieldName )
61- accountHostname := databricks .GetAccountHostname (databricks . GetHostname (cfg ))
62+ accountHostname := databricks .GetAccountHostname (getHostname (cfg ))
6263
6364 switch {
6465 case username != "" && password != "" :
@@ -108,8 +109,8 @@ func getConnector(ctx context.Context, cfg *viper.Viper) (types.ConnectorServer,
108109 return nil , err
109110 }
110111
111- hostname := databricks . GetHostname (cfg )
112- accountHostname := databricks .GetAccountHostname (databricks . GetHostname (cfg ))
112+ hostname := getHostname (cfg )
113+ accountHostname := databricks .GetAccountHostname (getHostname (cfg ))
113114 auth := prepareClientAuth (ctx , cfg )
114115 cb , err := connector .New (
115116 ctx ,
@@ -132,3 +133,10 @@ func getConnector(ctx context.Context, cfg *viper.Viper) (types.ConnectorServer,
132133
133134 return c , nil
134135}
136+
137+ func getHostname (cfg * viper.Viper ) string {
138+ if cfg .GetString (config .HostnameField .FieldName ) == "" {
139+ return defaultHost
140+ }
141+ return cfg .GetString (config .HostnameField .FieldName )
142+ }
0 commit comments