webserver

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package webserver serves the REST API and the web user interface.

Index

Constants

View Source
const (
	WebDisableAll string = "all"
	WebDisableUI  string = "ui"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdOpts

type CmdOpts struct {
	WebDisable  string `` /* 172-byte string literal not displayed */
	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 ReadyChecker added in v3.1.0

type ReadyChecker interface {
	Ready() bool
}

type WebUIServer

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

func Init

func Init(ctx context.Context, opts CmdOpts, webuifs fs.FS, mrw metrics.ReaderWriter, srw sources.ReaderWriter, rc ReadyChecker) (*WebUIServer, error)

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