Pārlūkot izejas kodu

CurrentUser only use global when needed

by needed: when host flag was supplied, matches that configured and a
user is set in config as well. they should be a pair.
pull/36/head
Rob Loranger pirms 4 gadiem
vecāks
revīzija
55dcf5e79c
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: D6F1633A4F0903B8
1 mainītis faili ar 8 papildinājumiem un 1 dzēšanām
  1. +8
    -1
      config/user.go

+ 8
- 1
config/user.go Parādīt failu

@@ -147,10 +147,17 @@ func CurrentUser(c *cli.Context) (string, error) {
}
if cfg.Default.User == "" {
// Load app-level config
cfg, err = LoadConfig(UserDataDir(c.App.ExtraInfo()["configDir"]))
globalCFG, err := LoadConfig(UserDataDir(c.App.ExtraInfo()["configDir"]))
if err != nil {
return "", err
}
// only user global defaults when both are set and hosts match
if globalCFG.Default.User != "" &&
globalCFG.Default.Host != "" &&
c.GlobalIsSet("host") &&
globalCFG.Default.Host == c.GlobalString("host") {
cfg = globalCFG
}
}

// Use user flag value


Notiek ielāde…
Atcelt
Saglabāt