command

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 11 Imported by: 117

Documentation

Index

Constants

View Source
const (
	// Version is the current Pgweb application version
	Version = "0.16.2"
)

Variables

View Source
var (
	// GitCommit contains the Git commit SHA for the binary
	GitCommit string

	// BuildTime contains the binary build time
	BuildTime string

	// BuildArch contains the OS architecture of the binary
	BuildArch string = fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)

	// GoVersion contains the build time Go version
	GoVersion string

	// Info contains all version information
	Info VersionInfo
)

Functions

func AvailableEnvVars added in v0.12.0

func AvailableEnvVars() string

AvailableEnvVars returns list of supported env vars.

TODO: These should probably be embedded into flag parsing logic so we dont have to maintain the list manually.

func SetDefaultOptions added in v0.9.12

func SetDefaultOptions() error

SetDefaultOptions parses and assigns the options

func VersionString added in v0.12.0

func VersionString() string

Types

type Options

type Options struct {
	Version                      bool   `short:"v" long:"version" description:"Print version"`
	Debug                        bool   `short:"d" long:"debug" description:"Enable debugging mode"`
	LogLevel                     string `long:"log-level" description:"Logging level" default:"info"`
	LogFormat                    string `long:"log-format" description:"Logging output format" default:"text"`
	LogForwardedUser             bool   `long:"log-forwarded-user" description:"Log user information available in X-Forwarded-User/Email headers"`
	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"`
	Passfile                     string `long:"passfile" description:"Local passwords file location"`
	DbName                       string `long:"db" description:"Database name"`
	SSLMode                      string `long:"ssl" description:"SSL mode"`
	SSLRootCert                  string `long:"ssl-rootcert" description:"SSL certificate authority file"`
	SSLCert                      string `long:"ssl-cert" description:"SSL client certificate file"`
	SSLKey                       string `long:"ssl-key" description:"SSL client certificate key file"`
	OpenTimeout                  int    `long:"open-timeout" description:"Maximum wait time for connection, in seconds" default:"30"`
	RetryDelay                   uint   `long:"open-retry-delay" description:"Number of seconds to wait before retrying the connection" default:"3"`
	RetryCount                   uint   `long:"open-retry" description:"Number of times to retry establishing connection" default:"0"`
	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"`
	Sessions                     bool   `long:"sessions" description:"Enable multiple database sessions"`
	Prefix                       string `long:"prefix" description:"Add a url prefix"`
	ReadOnly                     bool   `long:"readonly" description:"Run database connection in readonly mode"`
	LockSession                  bool   `long:"lock-session" description:"Lock session to a single database connection"`
	Bookmark                     string `` /* 144-byte string literal not displayed */
	BookmarksDir                 string `long:"bookmarks-dir" description:"Overrides default directory for bookmark files to search" default:""`
	BookmarksOnly                bool   `long:"bookmarks-only" description:"Allow only connections from bookmarks"`
	QueriesDir                   string `long:"queries-dir" description:"Overrides default directory for local queries"`
	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"`
	ConnectHeaders               string `long:"connect-headers" description:"List of headers to pass to the connect backend"`
	DisableConnectionIdleTimeout bool   `long:"no-idle-timeout" description:"Disable connection idle timeout"`
	ConnectionIdleTimeout        int    `long:"idle-timeout" description:"Set connection idle timeout in minutes" default:"180"`
	QueryTimeout                 uint   `long:"query-timeout" description:"Set global query execution timeout in seconds" default:"300"`
	Cors                         bool   `long:"cors" description:"Enable Cross-Origin Resource Sharing (CORS)"`
	CorsOrigin                   string `long:"cors-origin" description:"Allowed CORS origins" default:"*"`
	BinaryCodec                  string `` /* 126-byte string literal not displayed */
	MetricsEnabled               bool   `long:"metrics" description:"Enable Prometheus metrics endpoint"`
	MetricsPath                  string `long:"metrics-path" description:"Path prefix for Prometheus metrics endpoint" default:"/metrics"`
	MetricsAddr                  string `long:"metrics-addr" description:"Listen host and port for Prometheus metrics server"`
}
var Opts Options

func ParseOptions

func ParseOptions(args []string) (Options, error)

ParseOptions returns a new options struct from the input arguments

type VersionInfo added in v0.12.0

type VersionInfo struct {
	Version   string `json:"version"`
	GitCommit string `json:"git_sha"`
	BuildTime string `json:"build_time"`
	BuildArch string `json:"build_arch"`
	GoVersion string `json:"go_version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL