Lint
This commit is contained in:
@@ -12,15 +12,15 @@ import (
|
||||
type Options struct {
|
||||
Version bool `short:"v" long:"version" description:"Print version"`
|
||||
Debug bool `short:"d" long:"debug" description:"Enable debugging mode"`
|
||||
Url string `long:"url" description:"Database connection string"`
|
||||
URL string `long:"url" description:"Database connection string"`
|
||||
Host string `long:"host" description:"Server hostname or IP" default:"localhost"`
|
||||
Port int `long:"port" description:"Server port" default:"5432"`
|
||||
User string `long:"user" description:"Database user"`
|
||||
Pass string `long:"pass" description:"Password for user"`
|
||||
DbName string `long:"db" description:"Database name"`
|
||||
Ssl string `long:"ssl" description:"SSL option"`
|
||||
HttpHost string `long:"bind" description:"HTTP server host" default:"localhost"`
|
||||
HttpPort uint `long:"listen" description:"HTTP server listen port" default:"8081"`
|
||||
HTTPHost string `long:"bind" description:"HTTP server host" default:"localhost"`
|
||||
HTTPPort uint `long:"listen" description:"HTTP server listen port" default:"8081"`
|
||||
AuthUser string `long:"auth-user" description:"HTTP basic auth user"`
|
||||
AuthPass string `long:"auth-pass" description:"HTTP basic auth password"`
|
||||
SkipOpen bool `short:"s" long:"skip-open" description:"Skip browser open on start"`
|
||||
@@ -30,7 +30,7 @@ type Options struct {
|
||||
LockSession bool `long:"lock-session" description:"Lock session to a single database connection"`
|
||||
Bookmark string `short:"b" long:"bookmark" description:"Bookmark to use for connection. Bookmark files are stored under $HOME/.pgweb/bookmarks/*.toml" default:""`
|
||||
BookmarksDir string `long:"bookmarks-dir" description:"Overrides default directory for bookmark files to search" default:""`
|
||||
DisablePrettyJson bool `long:"no-pretty-json" description:"Disable JSON formatting feature for result export"`
|
||||
DisablePrettyJSON bool `long:"no-pretty-json" description:"Disable JSON formatting feature for result export"`
|
||||
DisableSSH bool `long:"no-ssh" description:"Disable database connections via SSH"`
|
||||
ConnectBackend string `long:"connect-backend" description:"Enable database authentication through a third party backend"`
|
||||
ConnectToken string `long:"connect-token" description:"Authentication token for the third-party connect backend"`
|
||||
@@ -51,8 +51,8 @@ func ParseOptions(args []string) (Options, error) {
|
||||
return opts, err
|
||||
}
|
||||
|
||||
if opts.Url == "" {
|
||||
opts.Url = os.Getenv("DATABASE_URL")
|
||||
if opts.URL == "" {
|
||||
opts.URL = os.Getenv("DATABASE_URL")
|
||||
}
|
||||
|
||||
if opts.Prefix == "" {
|
||||
@@ -80,7 +80,7 @@ func ParseOptions(args []string) (Options, error) {
|
||||
|
||||
if opts.Sessions || opts.ConnectBackend != "" {
|
||||
opts.Bookmark = ""
|
||||
opts.Url = ""
|
||||
opts.URL = ""
|
||||
opts.Host = ""
|
||||
opts.User = ""
|
||||
opts.Pass = ""
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestParseOptions(t *testing.T) {
|
||||
assert.Equal(t, "", opts.ConnectToken)
|
||||
assert.Equal(t, "", opts.ConnectHeaders)
|
||||
assert.Equal(t, false, opts.DisableSSH)
|
||||
assert.Equal(t, false, opts.DisablePrettyJson)
|
||||
assert.Equal(t, false, opts.DisablePrettyJSON)
|
||||
assert.Equal(t, false, opts.DisableConnectionIdleTimeout)
|
||||
assert.Equal(t, 180, opts.ConnectionIdleTimeout)
|
||||
assert.Equal(t, false, opts.Cors)
|
||||
|
||||
Reference in New Issue
Block a user