Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Commands []Cmd `json:"commands,omitempty"`
// contains filtered or unexported fields
}
App is top level module that runs shell commands.
func (App) CaddyModule ¶
func (a App) CaddyModule() caddy.ModuleInfo
CaddyModule implements caddy.ModuleInfo
type Cmd ¶
type Cmd struct {
// The command to run.
Command string `json:"command,omitempty"`
// The command args.
Args []string `json:"args,omitempty"`
// The directory to run the command from.
// Defaults to current directory.
Directory string `json:"directory,omitempty"`
// If the command should run in the foreground.
// By default, commands run in the background and doesn't
// affect Caddy.
// Setting this makes the command run in the foreground.
// Note that failure of a startup command running in the
// foreground may prevent Caddy from starting.
Foreground bool `json:"foreground,omitempty"`
// Timeout for the command. The command will be killed
// after timeout has elapsed if it is still running.
// Defaults to 10s.
Timeout string `json:"timeout,omitempty"`
// When the command should run. This can contain either of
// "startup" or "shutdown".
At []string `json:"at,omitempty"`
// Standard output log.
StdWriterRaw json.RawMessage `json:"log,omitempty" caddy:"namespace=caddy.logging.writers inline_key=output"`
// Standard error log.
ErrWriterRaw json.RawMessage `json:"err_log,omitempty" caddy:"namespace=caddy.logging.writers inline_key=output"`
// contains filtered or unexported fields
}
Cmd is the module configuration
func (*Cmd) UnmarshalCaddyfile ¶
UnmarshalCaddyfile configures the handler directive from Caddyfile. Syntax:
exec [<matcher>] [<command> [<args...>]] {
command <text>
args <text>...
directory <text>
timeout <duration>
log <log output module>
err_log <log output module>
foreground
startup
shutdown
}
type Middleware ¶
type Middleware struct {
Cmd
}
Middleware implements an HTTP handler that runs shell command.
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Cleanup ¶
func (m *Middleware) Cleanup() error
Cleanup implements caddy.Cleanup TODO: ensure all running processes are terminated.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Middleware) ServeHTTP ¶
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (Middleware) Validate ¶
func (m Middleware) Validate() error
Validate implements caddy.Validator
Click to show internal directories.
Click to hide internal directories.