Make --auth.method parameter optional Fixes: #715
This commit is contained in:
parent
88500ab219
commit
6e48a6b512
|
@ -44,8 +44,11 @@ func addConfigFlags(flags *pflag.FlagSet) {
|
|||
flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links")
|
||||
}
|
||||
|
||||
func getAuthentication(flags *pflag.FlagSet) (settings.AuthMethod, auth.Auther) {
|
||||
func getAuthentication(flags *pflag.FlagSet, defaults ...*settings.Settings) (settings.AuthMethod, auth.Auther) {
|
||||
method := settings.AuthMethod(mustGetString(flags, "auth.method"))
|
||||
if len(defaults) > 0 {
|
||||
method = defaults[0].AuthMethod
|
||||
}
|
||||
|
||||
var auther auth.Auther
|
||||
if method == auth.MethodProxyAuth {
|
||||
|
|
|
@ -71,6 +71,10 @@ you want to change. Other options will remain unchanged.`,
|
|||
} else {
|
||||
auther, err = d.store.Auth.Get(set.AuthMethod)
|
||||
checkErr(err)
|
||||
// check if there are new flags for existing auth method
|
||||
set.AuthMethod, auther = getAuthentication(flags, set)
|
||||
err = d.store.Auth.Save(auther)
|
||||
checkErr(err)
|
||||
}
|
||||
|
||||
err = d.store.Settings.Save(set)
|
||||
|
|
Loading…
Reference in New Issue