Documentation ¶
Overview ¶
Package handlers contains the HTTP server along with the requests and routes. All HTTP related functions are in this package.
More info on: https://github.com/statping/statping
Index ¶
- func DecodeJSON(r *http.Request, obj interface{}) error
- func ExecuteResponse(w http.ResponseWriter, r *http.Request, file string, data interface{}, ...)
- func Gzip(handler http.Handler) http.Handler
- func IsAdmin(r *http.Request) bool
- func IsFullAuthenticated(r *http.Request) bool
- func IsReadAuthenticated(r *http.Request) bool
- func IsUser(r *http.Request) bool
- func Router() *mux.Router
- func RunHTTPServer() error
- func SafeJson(val reflect.Value, scope string) map[string]interface{}
- func ScopeName(r *http.Request) string
- func StopHTTPServer(err error)
- type Cacher
- type ExportData
- type Item
- type JwtClaim
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶ added in v0.90.11
func ExecuteResponse ¶
func ExecuteResponse(w http.ResponseWriter, r *http.Request, file string, data interface{}, redirect interface{})
ExecuteResponse will render a HTTP response for the front end user
func IsFullAuthenticated ¶ added in v0.80.2
IsFullAuthenticated returns true if the HTTP request is authenticated. You can set the environment variable GO_ENV=test to bypass the admin authenticate to the dashboard features.
func IsReadAuthenticated ¶ added in v0.80.2
IsReadAuthenticated will allow Read Only authentication for some routes
func Router ¶
Router returns all of the routes used in Statping. Server will use static assets if the 'assets' directory is found in the root directory.
func RunHTTPServer ¶
func RunHTTPServer() error
RunHTTPServer will start a HTTP server on a specific IP and port
func ScopeName ¶ added in v0.90.11
ScopeName will show private JSON fields in the API. It will return "admin" if request has valid admin authentication.
func StopHTTPServer ¶ added in v0.90.47
func StopHTTPServer(err error)
Types ¶
type Cacher ¶ added in v0.79.1
type Cacher interface { Get(key string) []byte Delete(key string) Set(key string, content []byte, duration time.Duration) List() map[string]Item Lock() Unlock() StopRoutine() }
var CacheStorage Cacher
type ExportData ¶ added in v0.90.11
type ExportData struct { Config *configs.DbConfig `json:"config,omitempty"` Core *core.Core `json:"core"` Services []services.Service `json:"services"` Messages []*messages.Message `json:"messages"` Checkins []*checkins.Checkin `json:"checkins"` Users []*users.User `json:"users"` Groups []*groups.Group `json:"groups"` Notifiers []notifications.Notification `json:"notifiers"` }
func ExportSettings ¶ added in v0.90.11
func ExportSettings() (*ExportData, error)
func (*ExportData) JSON ¶ added in v0.90.67
func (e *ExportData) JSON() []byte
type Storage ¶ added in v0.79.1
type Storage struct {
// contains filtered or unexported fields
}
Storage mecanism for caching strings in memory
func NewStorage ¶ added in v0.79.1
func NewStorage() *Storage
NewStorage creates a new in memory CacheStorage
func (Storage) StopRoutine ¶ added in v0.90.11
func (s Storage) StopRoutine()
Source Files ¶
- api.go
- authentication.go
- cache.go
- checkin.go
- dashboard.go
- doc.go
- function.go
- groups.go
- handlers.go
- incident.go
- index.go
- jwt.go
- messages.go
- middleware.go
- notifications.go
- oauth.go
- oauth_custom.go
- oauth_github.go
- oauth_google.go
- oauth_slack.go
- routes.go
- scope.go
- server.go
- services.go
- setup.go
- users.go