Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make port/portStr variables in cmd more consistent #801

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cmd/externalbrowser/externalbrowser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,23 @@ func getDSN() (string, *sf.Config, error) {
account := env("SNOWFLAKE_TEST_ACCOUNT", true)
user := env("SNOWFLAKE_TEST_USER", true)
host := env("SNOWFLAKE_TEST_HOST", false)
port := env("SNOWFLAKE_TEST_PORT", false)
portStr := env("SNOWFLAKE_TEST_PORT", false)
protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

portStr, err := strconv.Atoi(port)
if err != nil {
return "", nil, err
port := 443 // snowflake default port
var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
return "", nil, err
}
}
cfg := &sf.Config{
Authenticator: sf.AuthTypeExternalBrowser,
Account: account,
User: user,
Host: host,
Port: portStr,
Port: port,
Protocol: protocol,
}

Expand Down
15 changes: 10 additions & 5 deletions cmd/keepalive/keepalive.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,28 @@ func getDSN() (string, *sf.Config, error) {
user := env("SNOWFLAKE_TEST_USER", true)
password := env("SNOWFLAKE_TEST_PASSWORD", true)
host := env("SNOWFLAKE_TEST_HOST", false)
port := env("SNOWFLAKE_TEST_PORT", false)
portStr := env("SNOWFLAKE_TEST_PORT", false)
protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

params := make(map[string]*string)
valueTrue := "true"
params["client_session_keep_alive"] = &valueTrue

portStr, err := strconv.Atoi(port)
if err != nil {
return "", nil, err
port := 443 // snowflake default port
var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
return "", nil, err
}
}

cfg := &sf.Config{
Account: account,
User: user,
Password: password,
Host: host,
Port: portStr,
Port: port,
Protocol: protocol,
Params: params,
}
Expand Down
1 change: 0 additions & 1 deletion cmd/keypair/keypair.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func getDSN() (string, *sf.Config, error) {
rsaPrivateKey, _ := privKey.(*rsa.PrivateKey)

port := 443 // snowflake default port
//var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
Expand Down
14 changes: 9 additions & 5 deletions cmd/mfa/mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,24 @@ func getDSN() (string, *sf.Config, error) {
user := env("SNOWFLAKE_TEST_USER", true)
password := env("SNOWFLAKE_TEST_PASSWORD", true)
host := env("SNOWFLAKE_TEST_HOST", false)
port := env("SNOWFLAKE_TEST_PORT", false)
portStr := env("SNOWFLAKE_TEST_PORT", false)
protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

portStr, err := strconv.Atoi(port)
if err != nil {
return "", nil, err
port := 443 // snowflake default port
var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
return "", nil, err
}
}
cfg := &sf.Config{
Account: account,
Authenticator: sf.AuthTypeUsernamePasswordMFA,
User: user,
Host: host,
Password: password,
Port: portStr,
Port: port,
Protocol: protocol,
}

Expand Down
13 changes: 10 additions & 3 deletions cmd/noconnpool/noconnpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ func getDSN() (string, *sf.Config, error) {
user := env("SNOWFLAKE_TEST_USER", true)
password := env("SNOWFLAKE_TEST_PASSWORD", true)
host := env("SNOWFLAKE_TEST_HOST", false)
port := env("SNOWFLAKE_TEST_PORT", false)
portStr := env("SNOWFLAKE_TEST_PORT", false)
protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

portStr, err := strconv.Atoi(port)
port := 443 // snowflake default port
var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
return "", nil, err
}
}
if err != nil {
return "", nil, err
}
Expand All @@ -44,7 +51,7 @@ func getDSN() (string, *sf.Config, error) {
User: user,
Password: password,
Host: host,
Port: portStr,
Port: port,
Protocol: protocol,
}

Expand Down
14 changes: 9 additions & 5 deletions cmd/selectmany/selectmany.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,23 @@ func getDSN() (string, *sf.Config, error) {
user := env("SNOWFLAKE_TEST_USER", true)
password := env("SNOWFLAKE_TEST_PASSWORD", true)
host := env("SNOWFLAKE_TEST_HOST", false)
port := env("SNOWFLAKE_TEST_PORT", false)
portStr := env("SNOWFLAKE_TEST_PORT", false)
protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

portStr, err := strconv.Atoi(port)
if err != nil {
return "", nil, err
port := 443 // snowflake default port
var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
return "", nil, err
}
}
cfg := &sf.Config{
Account: account,
User: user,
Password: password,
Host: host,
Port: portStr,
Port: port,
Protocol: protocol,
}

Expand Down
14 changes: 9 additions & 5 deletions cmd/showparam/showparam.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ func getDSN(params map[string]*string) (string, *sf.Config, error) {
user := env("SNOWFLAKE_TEST_USER", true)
password := env("SNOWFLAKE_TEST_PASSWORD", true)
host := env("SNOWFLAKE_TEST_HOST", false)
port := env("SNOWFLAKE_TEST_PORT", false)
portStr := env("SNOWFLAKE_TEST_PORT", false)
protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

portStr, err := strconv.Atoi(port)
if err != nil {
return "", nil, err
port := 443 // snowflake default port
var err error
if len(portStr) > 0 {
port, err = strconv.Atoi(portStr)
if err != nil {
return "", nil, err
}
}
cfg := &sf.Config{
Account: account,
User: user,
Password: password,
Host: host,
Port: portStr,
Port: port,
Protocol: protocol,
Params: params,
}
Expand Down
Loading