service

package
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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Username                      string `json:"username,omitempty"`
	Password                      string `json:"password,omitempty"`
	KeyPath                       string `json:"key_path,omitempty"`
	KeyPassphrase                 string `json:"key_passphrase,omitempty"`
	StrictHostKeyCheckingDisabled bool   `json:"strict_host_key_checking_disabled,omitempty"`
}

AuthConfig is authentication configuration in RepositoryConfig.

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:"-"`
	Path           string `json:"path,omitempty" xml:"path,omitempty" yaml:"path,omitempty"`
	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 ExecConfig

type ExecConfig struct {
	Name    string   `json:"name,omitempty"`
	Command string   `json:"command,omitempty"`
	Args    []string `json:"args,omitempty"`
}

ExecConfig is an execution script configuration in RepositoryConfig.

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"`
	// The interval at which repository updates automatically.
	UpdateInterval int              `json:"update_interval,omitempty"`
	Auth           *AuthConfig      `json:"auth,omitempty"`
	Webhooks       []*WebhookConfig `json:"webhooks,omitempty"`
	PostPullExec   []*ExecConfig    `json:"post_pull_exec,omitempty"`
	// contains filtered or unexported fields
}

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.

type WebhookConfig

type WebhookConfig struct {
	Name   string `json:"name,omitempty"`
	Header string `json:"header,omitempty"`
	Secret string `json:"secret,omitempty"`
}

WebhookConfig is a webhook configuration in RepositoryConfig.

Jump to

Keyboard shortcuts

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