do not use viper in config subcmds

This commit is contained in:
1138-4EB 2019-01-07 23:52:12 +01:00
parent b178c6af99
commit 4511084eb7

View File

@ -13,7 +13,6 @@ import (
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
v "github.com/spf13/viper"
)
func init() {
@ -29,26 +28,21 @@ var configCmd = &cobra.Command{
}
func addConfigFlags(f *pflag.FlagSet) {
addUserFlags(f)
vaddP(f, "signup", "s", false, "allow users to signup")
vadd(f, "shell", "", "shell command to which other commands should be appended")
f.BoolP("signup", "s", false, "allow users to signup")
f.String("shell", "", "shell command to which other commands should be appended")
vadd(f, "auth.method", string(auth.MethodJSONAuth), "authentication type")
vadd(f, "auth.header", "", "HTTP header for auth.method=proxy")
f.String("auth.method", string(auth.MethodJSONAuth), "authentication type")
f.String("auth.header", "", "HTTP header for auth.method=proxy")
vadd(f, "recaptcha.host", "https://www.google.com", "use another host for ReCAPTCHA. recaptcha.net might be useful in China")
vadd(f, "recaptcha.key", "", "ReCaptcha site key")
vadd(f, "recaptcha.secret", "", "ReCaptcha secret")
f.String("recaptcha.host", "https://www.google.com", "use another host for ReCAPTCHA. recaptcha.net might be useful in China")
f.String("recaptcha.key", "", "ReCaptcha site key")
f.String("recaptcha.secret", "", "ReCaptcha secret")
vadd(f, "branding.name", "", "replace 'File Browser' by this name")
vadd(f, "branding.files", "", "path to directory with images and custom styles")
vadd(f, "branding.disableExternal", false, "disable external links such as GitHub links")
if err := v.BindPFlags(f); err != nil {
panic(err)
}
f.String("branding.name", "", "replace 'File Browser' by this name")
f.String("branding.files", "", "path to directory with images and custom styles")
f.Bool("branding.disableExternal", false, "disable external links such as GitHub links")
}
func getAuthentication(cmd *cobra.Command) (settings.AuthMethod, auth.Auther) {