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 MaintenanceRouter() *mux.Router
- func Router() *mux.Router
- func RunHTTPServer()
- func SafeJson(val reflect.Value, scope string) map[string]interface{}
- func ScopeName(r *http.Request) string
- func StopHTTPServer(err error)
- type ExportData
- type JwtClaim
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
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 ¶
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 ¶
IsReadAuthenticated will allow Read Only authentication for some routes
func MaintenanceRouter ¶
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 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()
RunHTTPServer will start a HTTP server on a specific IP and port
func ScopeName ¶
ScopeName will show private JSON fields in the API. It will return "admin" if request has valid admin authentication.
func StopHTTPServer ¶
func StopHTTPServer(err error)
Types ¶
type ExportData ¶
type ExportData struct { Config *configs.DbConfig `json:"config,omitempty"` Core *core.Core `json:"core"` Services []services.Service `json:"services"` Messages []*messages.Message `json:"messages"` Incidents []*incidents.Incident `json:"incidents"` IncidentUpdates []*incidents.IncidentUpdate `json:"incident_updates"` Checkins []*checkins.Checkin `json:"checkins"` Users []*users.User `json:"users"` Groups []*groups.Group `json:"groups"` Notifiers []notifications.Notification `json:"notifiers"` }
func ExportSettings ¶
func ExportSettings() (*ExportData, error)
func (*ExportData) JSON ¶
func (e *ExportData) JSON() []byte
Source Files ¶
- api.go
- authentication.go
- checkin.go
- dashboard.go
- doc.go
- function.go
- groups.go
- handlers.go
- incident.go
- index.go
- jwt.go
- maintenanceRoutes.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