Clear out connection settings when running in session/connect mode

This commit is contained in:
Dan Sosedoff 2018-09-14 00:54:42 -05:00
parent 527c680e1f
commit badcf700b9

View File

@ -63,6 +63,15 @@ func ParseOptions(args []string) (Options, error) {
opts.Sessions = false opts.Sessions = false
} }
if opts.Sessions || opts.ConnectBackend != "" {
opts.Url = ""
opts.Host = ""
opts.User = ""
opts.Pass = ""
opts.DbName = ""
opts.Ssl = ""
}
if opts.Prefix != "" && !strings.Contains(opts.Prefix, "/") { if opts.Prefix != "" && !strings.Contains(opts.Prefix, "/") {
opts.Prefix = opts.Prefix + "/" opts.Prefix = opts.Prefix + "/"
} }
@ -75,10 +84,6 @@ func ParseOptions(args []string) (Options, error) {
opts.AuthPass = os.Getenv("AUTH_PASS") opts.AuthPass = os.Getenv("AUTH_PASS")
} }
if opts.Bookmark != "" && opts.Sessions {
return opts, errors.New("--bookmark is not allowed in multi-session mode")
}
if opts.ConnectBackend != "" { if opts.ConnectBackend != "" {
if !opts.Sessions { if !opts.Sessions {
return opts, errors.New("--sessions flag must be set") return opts, errors.New("--sessions flag must be set")