Skip to content
Merged
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
17 changes: 12 additions & 5 deletions cmd/modern/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,20 @@ func initializeEnvVars() {
if os.Getenv("SQLCMDSERVER") == "" {
os.Setenv("SQLCMDSERVER", server)
}
if os.Getenv("SQLCMDUSER") == "" {
os.Setenv("SQLCMDUSER", username)
}
if os.Getenv("SQLCMDPASSWORD") == "" {
os.Setenv("SQLCMDPASSWORD", password)

// Username and password should come together, either from the environment
// variables set by the user before the sqlcmd process started, or from the sqlconfig
// for the current context, but if just the environment variable SQLCMDPASSWORD
// is set before the process starts we do not use it, if the user and password is set in sqlconfig.
if username != "" && password != "" { // If not trusted auth
if os.Getenv("SQLCMDUSER") == "" {
os.Setenv("SQLCMDUSER", username)
os.Setenv("SQLCMDPASSWORD", password)
}
}

}

}

// isFirstArgModernCliSubCommand is TEMPORARY code, to be removed when
Expand Down