webserver

package
v3.0.0-...-2700aaf Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdOpts

type CmdOpts struct {
	WebDisable  bool   `long:"web-disable" mapstructure:"web-disable" description:"Disable the web UI" env:"PW_WEBDISABLE"`
	WebAddr     string `` /* 135-byte string literal not displayed */
	WebUser     string `long:"web-user" mapstructure:"web-user" description:"Admin login" env:"PW_WEBUSER"`
	WebPassword string `long:"web-password" mapstructure:"web-password" description:"Admin password" env:"PW_WEBPASSWORD"`
}

CmdOpts specifies the internal web UI server command-line options

type EnsureAuth

type EnsureAuth struct {
	// contains filtered or unexported fields
}

func NewEnsureAuth

func NewEnsureAuth(handlerToWrap http.HandlerFunc) *EnsureAuth

func (*EnsureAuth) ServeHTTP

func (ea *EnsureAuth) ServeHTTP(w http.ResponseWriter, r *http.Request)

type WebUIServer

type WebUIServer struct {
	http.Server
	CmdOpts
	// contains filtered or unexported fields
}

func Init

func Init(opts CmdOpts, webuifs fs.FS, mrw metrics.ReaderWriter, srw sources.ReaderWriter, logger log.LoggerIface) *WebUIServer

func (*WebUIServer) DeleteMetric

func (server *WebUIServer) DeleteMetric(name string) error

DeleteMetric removes the metric from the configuration

func (*WebUIServer) DeletePreset

func (server *WebUIServer) DeletePreset(name string) error

DeletePreset removes the preset from the configuration

func (*WebUIServer) DeleteSource

func (server *WebUIServer) DeleteSource(database string) error

DeleteSource removes the source from the list of configured sources

func (*WebUIServer) GetMetrics

func (server *WebUIServer) GetMetrics() (res string, err error)

GetMetrics returns the list of metrics

func (*WebUIServer) GetPresets

func (server *WebUIServer) GetPresets() (res string, err error)

GetPresets ret urns the list of available presets

func (*WebUIServer) GetSources

func (server *WebUIServer) GetSources() (res string, err error)

GetSources returns the list of sources fo find databases for monitoring

func (*WebUIServer) IsCorrectPassword

func (Server *WebUIServer) IsCorrectPassword(lr loginReq) bool

func (*WebUIServer) TryConnectToDB

func (server *WebUIServer) TryConnectToDB(params []byte) (err error)

func (*WebUIServer) UpdateMetric

func (server *WebUIServer) UpdateMetric(name string, params []byte) error

UpdateMetric updates the stored metric information

func (*WebUIServer) UpdatePreset

func (server *WebUIServer) UpdatePreset(name string, params []byte) error

UpdatePreset updates the stored preset

func (*WebUIServer) UpdateSource

func (server *WebUIServer) UpdateSource(params []byte) error

UpdateSource updates the configured source information

Jump to

Keyboard shortcuts

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