Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
func Chain(f http.HandlerFunc, middlewares ...Middleware) http.HandlerFunc
Chain applies middlewares to a http.HandlerFunc
func CreateConfigFile ¶
func CreateConfigFile(w http.ResponseWriter, r *http.Request)
CreateConfigFile creates the actual config file based on the input from the user.
func NeuterAndLog ¶
NeuterAndLog is used for static files and returns a not found if the request ends in a '/' (meaning they want to look at the directory and not view a file). Also logs the request.
func NewConfigPage ¶
func NewConfigPage(w http.ResponseWriter, r *http.Request)
NewConfigPage returns the new config html page
func WriteAccessLog ¶
WriteAccessLog creates the access log string and writes it to file.
Types ¶
type Middleware ¶
type Middleware func(http.HandlerFunc) http.HandlerFunc
Middleware declares middlware as alias of HandlerFunc
func AdminPage ¶
func AdminPage() Middleware
AdminPage checks if the user is an admin. If the user is, it grants access otherwise returns a not found.
func ConfigFileExists ¶
func ConfigFileExists() Middleware
ConfigFileExists is a middleware that checks if the config file exists. If it doesn't, we display the create config file page.