admin

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configuration{}

Functions

func AdminIndex

func AdminIndex(rw http.ResponseWriter, r *http.Request)

AdminIndex is the default http.Handler for admin module. it matches url pattern "/".

func Healthcheck

func Healthcheck(rw http.ResponseWriter, req *http.Request)

Healthcheck is a http.Handler calling health checking and showing the result. it's in "/healthcheck" pattern in admin module.

func ListConf

func ListConf(rw http.ResponseWriter, r *http.Request)

ListConf is the http.Handler of displaying all configuration values as key/value pair. it's registered with url pattern "/listconf" in admin module.

func ProfIndex

func ProfIndex(rw http.ResponseWriter, r *http.Request)

ProfIndex is a http.Handler for showing profile command. it's in url pattern "/prof" in admin module.

func RunTask

func RunTask(rw http.ResponseWriter, req *http.Request)

RunTask is a http.Handler to run a Task from the "query string. the request url likes /runtask?taskname=sendmail.

func TaskStatus

func TaskStatus(rw http.ResponseWriter, req *http.Request)

TaskStatus is a http.Handler with running task status (task name, status and the last execution). it's in "/task" pattern in admin module.

Types

type AdminApp

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

AdminApp is an http.HandlerFunc map used as AdminApp.

var MyAdminApp *AdminApp

MyAdminApp is the default AdminApp used by admin module.

func (*AdminApp) Route

func (admin *AdminApp) Route(pattern string, f http.HandlerFunc)

Route adds http.HandlerFunc to AdminApp with url pattern.

func (*AdminApp) Start

func (admin *AdminApp) Start(AdminHttpAddr string, AdminHttpPort int)

Start AdminApp http server. Its addr is defined in configuration file as adminhttpaddr and adminhttpport.

type Configuration

type Configuration struct {
	SupportAdmin  bool
	AdminHttpAddr string
	AdminHttpPort int
	WhiteHttpAddr []string
}

func (*Configuration) Close

func (c *Configuration) Close() error

func (*Configuration) Init

func (c *Configuration) Init() error

func (*Configuration) Name

func (c *Configuration) Name() string

type TaskRunResult

type TaskRunResult struct {
	Code int
	Err  string
}

Jump to

Keyboard shortcuts

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