git

package
v0.0.0-...-3a545d7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTP

func HTTP(fs billy.Filesystem) http.FileSystem

HTTP translates a billy.Filesystem into an http.FileSystem that can be used with the http.FileServer.

Types

type Config

type Config struct {
	URL          string        `json:"url"           usage:"the git url used to clone the repository"`
	Branch       string        `json:"branch"        usage:"the name of the git branch to clone"`
	Tag          string        `json:"tag"           usage:"the name of the git tag to clone"`
	Username     string        `json:"username"      usage:"the username used to authenticate with the git service"`
	Password     string        `json:"password"      usage:"the password used to authenticate with the git service"`
	SyncInterval time.Duration `json:"sync_interval" usage:"how frequently the git repository is pulled for changes" default:"1h"`
}

Config encapsulates the elements that can be configured about the git service.

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(ctx context.Context, multi EndpointConfig) (endpoint *Endpoint, err error)

func (*Endpoint) Close

func (e *Endpoint) Close() error

func (*Endpoint) Lookup

func (e *Endpoint) Lookup(w http.ResponseWriter, r *http.Request)

func (*Endpoint) Sync

func (e *Endpoint) Sync(w http.ResponseWriter, r *http.Request)

func (*Endpoint) SyncLoop

func (e *Endpoint) SyncLoop(ctx context.Context) error

type EndpointConfig

type EndpointConfig struct {
	Sites map[string]*Config `json:"sites"`
}

type Service

type Service struct {
	Store      *memory.Storage
	FS         billy.Filesystem
	Repository *git.Repository
	// contains filtered or unexported fields
}

Service encapsulates operations that can be performed against the target git repository.

func NewService

func NewService(config Config) (*Service, error)

NewService constructs a Service that manages the underlying git repository.

func (*Service) Load

func (s *Service) Load(ctx context.Context) (err error)

Load initializes the git repository given the provided options. This _should_ only be called once.

func (*Service) Sync

func (s *Service) Sync(ctx context.Context) error

Sync pulls the underlying repository to ensure it's up-to-date.

Jump to

Keyboard shortcuts

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