git

package module
v0.0.0-...-262718c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

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:

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

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.

func (*App) Provision

func (app *App) Provision(ctx caddy.Context) error

Provision sets up the repo manager.

func (App) Start

func (app App) Start() error

Start starts the App.

func (App) Stop

func (app App) Stop() error

Stop stops the App.

type Middleware

type Middleware struct {
	Endpoint *service.Endpoint `json:"endpoint,omitempty"`
}

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

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.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL