File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -62,13 +62,20 @@ func initializeEnvVars() {
62
62
if os .Getenv ("SQLCMDSERVER" ) == "" {
63
63
os .Setenv ("SQLCMDSERVER" , server )
64
64
}
65
- if os .Getenv ("SQLCMDUSER" ) == "" {
66
- os .Setenv ("SQLCMDUSER" , username )
67
- }
68
- if os .Getenv ("SQLCMDPASSWORD" ) == "" {
69
- os .Setenv ("SQLCMDPASSWORD" , password )
65
+
66
+ // Username and password should come together, either from the environment
67
+ // variables set by the user before the sqlcmd process started, or from the sqlconfig
68
+ // for the current context, but if just the environment variable SQLCMDPASSWORD
69
+ // is set before the process starts we do not use it, if the user and password is set in sqlconfig.
70
+ if username != "" && password != "" { // If not trusted auth
71
+ if os .Getenv ("SQLCMDUSER" ) == "" {
72
+ os .Setenv ("SQLCMDUSER" , username )
73
+ os .Setenv ("SQLCMDPASSWORD" , password )
74
+ }
70
75
}
76
+
71
77
}
78
+
72
79
}
73
80
74
81
// isFirstArgModernCliSubCommand is TEMPORARY code, to be removed when
You can’t perform that action at this time.
0 commit comments