README
¶
caddy-git
Git Plugin for Caddy v2.
Inspired by this comment.
Please ask questions either here or via LinkedIn. I am happy to help you! @greenpau
Please see other plugins:
Table of Contents
Overview
The caddy-git
allows updating a directory backed by a git repo.
Getting Started
Configuration examples:
- Public repo over HTTPS
- Private or public repo over SSH with key-based authentication
- Repo with Webhooks
- Repo with post pull execution scripts
- Routeless config
For example, the following configuration sets up a definition for authp.github.io
repo. The request to authp.myfiosgateway.com/update/authp.github.io
trigger
git pull
of the authp.github.io
repository.
{
git {
repo authp.github.io {
base_dir /tmp
url https://github.com/authp/authp.github.io.git
branch gh-pages
post pull exec {
name Pager
command /usr/bin/echo
args "pulled authp.github.io repo"
}
}
}
}
authp.myfiosgateway.com {
route /version* {
respond * "1.0.0" 200
}
route /update/authp.github.io {
git update repo authp.github.io
}
route {
file_server {
root /tmp/authp.github.io
}
}
}
The cloning of the repository happens on startup. Additionally, the cloning
happens when /update/authp.github.io
is being hit.
curl https://authp.myfiosgateway.com/update/authp.github.io
Documentation
¶
Index ¶
- type App
- type Middleware
- func (Middleware) CaddyModule() caddy.ModuleInfo
- func (m *Middleware) Provision(ctx caddy.Context) error
- func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error
- func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) (err error)
- func (m *Middleware) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Name string `json:"-"` Config *service.Config `json:"config,omitempty"` // contains filtered or unexported fields }
App implements git repository manager.
func (App) CaddyModule ¶
func (App) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type Middleware ¶
Middleware implements git repository manager.
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision provisions git repository endpoint.
func (Middleware) ServeHTTP ¶
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error
ServeHTTP performs git repository management tasks.
func (*Middleware) UnmarshalCaddyfile ¶
func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) (err error)
UnmarshalCaddyfile unmarshals a Caddyfile.
func (*Middleware) Validate ¶
func (m *Middleware) Validate() error
Validate implements caddy.Validator.