service

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Repositories []*RepositoryConfig `json:"repositories,omitempty"`
	// contains filtered or unexported fields
}

Config is a configuration of Manager.

func NewConfig

func NewConfig() *Config

NewConfig returns an instance of Config.

func (*Config) AddRepository

func (cfg *Config) AddRepository(rc *RepositoryConfig) error

AddRepository adds a repository entry to Config.

type Endpoint

type Endpoint struct {
	Name           string `json:"-"`
	RepositoryName string
	// contains filtered or unexported fields
}

Endpoint handles git management requests.

func (*Endpoint) Provision

func (m *Endpoint) Provision() error

Provision configures the instance of Endpoint.

func (*Endpoint) ServeHTTP

func (m *Endpoint) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request) error

ServeHTTP serves git management requests.

func (*Endpoint) SetLogger

func (m *Endpoint) SetLogger(logger *zap.Logger)

SetLogger add logger to Endpoint.

func (*Endpoint) Validate

func (m *Endpoint) Validate() error

Validate implements caddy.Validator.

type Manager

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

Manager manages git repositories

func NewManager

func NewManager(cfg *Config, logger *zap.Logger) (*Manager, error)

NewManager parses config and creates Manager instance.

func (*Manager) Start

func (m *Manager) Start() []*Status

Start starts Manager.

func (*Manager) Stop

func (m *Manager) Stop() []*Status

Stop stops Manager.

type Repository

type Repository struct {
	Config *RepositoryConfig `json:"config,omitempty"`
	// contains filtered or unexported fields
}

Repository is a configuration for a command or app.

func NewRepository

func NewRepository(rc *RepositoryConfig) (*Repository, error)

NewRepository returns an instance of Repository.

type RepositoryConfig

type RepositoryConfig struct {
	// The alias for the Repository.
	Name string `json:"name,omitempty"`
	// The address of the Repository.
	Address string `json:"address,omitempty"`
	// The directory where the Repository is being stored locally.
	BaseDir string `json:"base_dir,omitempty"`
	Branch  string `json:"branch,omitempty"`
	Depth   int    `json:"depth,omitempty"`
}

RepositoryConfig is a configuration of Repository.

func NewRepositoryConfig

func NewRepositoryConfig() *RepositoryConfig

NewRepositoryConfig returns an instance of RepositoryConfig.

type Status

type Status struct {
	Repository string `json:"repository,omitempty"`
	Error      error  `json:"error,omitempty"`
}

Status represent the last recorded status of a git repository.

Jump to

Keyboard shortcuts

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