config

package
v14.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GitalyDataPrefix is the top-level directory we use to store system
	// (non-user) data. We need to be careful that this path does not clash
	// with any directory name that could be provided by a user. The '+'
	// character is not allowed in GitLab namespaces or repositories.
	GitalyDataPrefix = "+gitaly"
)

Variables

This section is empty.

Functions

func ConfigureConcurrencyLimits

func ConfigureConcurrencyLimits(cfg Cfg)

ConfigureConcurrencyLimits configures the per-repo, per RPC rate limits

func NewLocator

func NewLocator(conf Cfg) storage.Locator

NewLocator returns locator based on the provided configuration struct. As it creates a shallow copy of the provided struct changes made into provided struct may affect result of methods implemented by it.

func SkipHooks

func SkipHooks() bool

Types

type Cfg

type Cfg struct {
	SocketPath             string            `toml:"socket_path" split_words:"true"`
	ListenAddr             string            `toml:"listen_addr" split_words:"true"`
	TLSListenAddr          string            `toml:"tls_listen_addr" split_words:"true"`
	PrometheusListenAddr   string            `toml:"prometheus_listen_addr" split_words:"true"`
	BinDir                 string            `toml:"bin_dir"`
	Git                    Git               `toml:"git" envconfig:"git"`
	Storages               []Storage         `toml:"storage" envconfig:"storage"`
	Logging                Logging           `toml:"logging" envconfig:"logging"`
	Prometheus             prometheus.Config `toml:"prometheus"`
	Auth                   auth.Config       `toml:"auth"`
	TLS                    TLS               `toml:"tls"`
	Ruby                   Ruby              `toml:"gitaly-ruby"`
	Gitlab                 Gitlab            `toml:"gitlab"`
	GitlabShell            GitlabShell       `toml:"gitlab-shell"`
	Hooks                  Hooks             `toml:"hooks"`
	Concurrency            []Concurrency     `toml:"concurrency"`
	GracefulRestartTimeout Duration          `toml:"graceful_restart_timeout"`
	InternalSocketDir      string            `toml:"internal_socket_dir"`
	DailyMaintenance       DailyJob          `toml:"daily_maintenance"`
	Cgroups                cgroups.Config    `toml:"cgroups"`
	PackObjectsCache       PackObjectsCache  `toml:"pack_objects_cache"`
}

Cfg is a container for all config derived from config.toml.

func Load

func Load(file io.Reader) (Cfg, error)

Load initializes the Config variable from file and the environment.

Environment variables take precedence over the file.

func (*Cfg) ConfigureRuby

func (cfg *Cfg) ConfigureRuby() error

ConfigureRuby validates the gitaly-ruby configuration and sets default values.

func (*Cfg) GitalyInternalSocketPath

func (cfg *Cfg) GitalyInternalSocketPath() string

GitalyInternalSocketPath is the path to the internal gitaly socket

func (*Cfg) SetGitPath

func (cfg *Cfg) SetGitPath() error

SetGitPath populates the variable GitPath with the path to the `git` executable. It warns if no path was specified in the configuration.

func (*Cfg) Storage

func (cfg *Cfg) Storage(storageName string) (Storage, bool)

Storage looks up storageName.

func (*Cfg) StoragePath

func (cfg *Cfg) StoragePath(storageName string) (string, bool)

StoragePath looks up the base path for storageName. The second boolean return value indicates if anything was found.

func (*Cfg) Validate

func (cfg *Cfg) Validate() error

Validate checks the current Config for sanity.

type Concurrency

type Concurrency struct {
	RPC        string `toml:"rpc"`
	MaxPerRepo int    `toml:"max_per_repo"`
}

Concurrency allows endpoints to be limited to a maximum concurrency per repo

type DailyJob

type DailyJob struct {
	Hour     uint     `toml:"start_hour"`
	Minute   uint     `toml:"start_minute"`
	Duration Duration `toml:"duration"`
	Storages []string `toml:"storages"`

	// Disabled will completely disable a daily job, even in cases where a
	// default schedule is implied
	Disabled bool `toml:"disabled"`
}

DailyJob enables a daily task to be scheduled for specific storages

type Duration

type Duration time.Duration

Duration is a trick to let our TOML library parse durations from strings.

func (*Duration) Duration

func (d *Duration) Duration() time.Duration

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type Git

type Git struct {
	BinPath          string      `toml:"bin_path"`
	CatfileCacheSize int         `toml:"catfile_cache_size"`
	Config           []GitConfig `toml:"config"`
}

Git contains the settings for the Git executable

type GitConfig

type GitConfig struct {
	Key   string `toml:"key"`
	Value string `toml:"value"`
}

GitConfig contains a key-value pair which is to be passed to git as configuration.

type Gitlab

type Gitlab struct {
	URL             string       `toml:"url" json:"url"`
	RelativeURLRoot string       `toml:"relative_url_root" json:"relative_url_root"` // For UNIX sockets only
	HTTPSettings    HTTPSettings `toml:"http-settings" json:"http_settings"`
	SecretFile      string       `toml:"secret_file" json:"secret_file"`
}

Gitlab contains settings required to connect to the Gitlab api

type GitlabShell

type GitlabShell struct {
	Dir string `toml:"dir" json:"dir"`
}

GitlabShell contains the settings required for executing `gitlab-shell`

type HTTPSettings

type HTTPSettings struct {
	ReadTimeout int    `toml:"read_timeout" json:"read_timeout"`
	User        string `toml:"user" json:"user"`
	Password    string `toml:"password" json:"password"`
	CAFile      string `toml:"ca_file" json:"ca_file"`
	CAPath      string `toml:"ca_path" json:"ca_path"`
	SelfSigned  bool   `toml:"self_signed_cert" json:"self_signed_cert"`
}

type Hooks

type Hooks struct {
	CustomHooksDir string `toml:"custom_hooks_dir" json:"custom_hooks_dir"`
}

Hooks contains the settings required for hooks

type Logging

type Logging struct {
	internallog.Config
	Sentry

	RubySentryDSN string `toml:"ruby_sentry_dsn"`
}

Logging contains the logging configuration for Gitaly

type PackObjectsCache

type PackObjectsCache struct {
	Enabled bool     `toml:"enabled"` // Default: false
	Dir     string   `toml:"dir"`     // Default: <FIRST STORAGE PATH>/+gitaly/PackObjectsCache
	MaxAge  Duration `toml:"max_age"` // Default: 5m
}

PackObjectsCache contains settings for the pack-objects cache.

type Ruby

type Ruby struct {
	Dir                       string   `toml:"dir"`
	MaxRSS                    int      `toml:"max_rss"`
	GracefulRestartTimeout    Duration `toml:"graceful_restart_timeout"`
	RestartDelay              Duration `toml:"restart_delay"`
	NumWorkers                int      `toml:"num_workers"`
	LinguistLanguagesPath     string   `toml:"linguist_languages_path"`
	RuggedGitConfigSearchPath string   `toml:"rugged_git_config_search_path"`
}

Ruby contains setting for Ruby worker processes

type Sentry

type Sentry sentry.Config

Sentry is a sentry.Config. We redefine this type to a different name so we can embed both structs into Logging

type Storage

type Storage struct {
	Name string
	Path string
}

Storage contains a single storage-shard

type TLS

type TLS struct {
	CertPath string `toml:"certificate_path"`
	KeyPath  string `toml:"key_path"`
}

TLS configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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