Documentation
¶
Overview ¶
Package config provides configuration management for gitlab-shell. It handles loading and parsing of YAML configuration files and provides access to HTTP clients and other shared resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultConfig = Config{ LogFile: "gitlab-shell.log", LogFormat: "json", LogLevel: "info", Server: DefaultServerConfig, User: "git", PATConfig: DefaultPATConfig, } DefaultServerConfig = ServerConfig{ Listen: "[::]:22", WebListen: "localhost:9122", ConcurrentSessionsLimit: 10, GracePeriod: YamlDuration(10 * time.Second), ClientAliveInterval: YamlDuration(15 * time.Second), ProxyHeaderTimeout: YamlDuration(500 * time.Millisecond), LoginGraceTime: YamlDuration(60 * time.Second), ReadinessProbe: "/start", LivenessProbe: "/health", HostKeyFiles: []string{ "/run/secrets/ssh-hostkeys/ssh_host_rsa_key", "/run/secrets/ssh-hostkeys/ssh_host_ecdsa_key", "/run/secrets/ssh-hostkeys/ssh_host_ed25519_key", }, } DefaultPATConfig = PATConfig{ Enabled: true, } )
The defaults to apply before parsing the config file(s).
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
User string `yaml:"user,omitempty"`
RootDir string
LogFile string `yaml:"log_file,omitempty"`
LogFormat string `yaml:"log_format,omitempty"`
LogLevel string `yaml:"log_level,omitempty"`
GitlabURL string `yaml:"gitlab_url"`
GitlabRelativeURLRoot string `yaml:"gitlab_relative_url_root"`
GitlabTracing string `yaml:"gitlab_tracing"`
// SecretFilePath is only for parsing. Application code should always use Secret.
SecretFilePath string `yaml:"secret_file"`
Secret string `yaml:"secret"`
SslCertDir string `yaml:"ssl_cert_dir"`
HTTPSettings HTTPSettingsConfig `yaml:"http_settings"`
Server ServerConfig `yaml:"sshd"`
LFSConfig LFSConfig `yaml:"lfs"`
PATConfig PATConfig `yaml:"pat"`
// TopologyService contains Topology Service client configuration for Cells routing.
TopologyService topology.Config `yaml:"topology_service"`
GitalyClient gitaly.Client
// contains filtered or unexported fields
}
Config represents the main gitlab-shell configuration.
func NewFromDir ¶
NewFromDir returns a new config given a root directory. It looks for the config file name in the given directory and reads the config from it. It doesn't apply any defaults. New code should prefer this over NewFromDirIntegrated and apply the right default via one of the Apply... functions.
func NewFromDirExternal ¶
NewFromDirExternal returns a new config from a given root dir. It also applies defaults appropriate for gitlab-shell running in an external SSH server.
func (*Config) ApplyGlobalState ¶
func (c *Config) ApplyGlobalState()
ApplyGlobalState applies configuration settings that affect global process state, such as environment variables.
func (*Config) HTTPClient ¶ added in v14.36.0
func (c *Config) HTTPClient() (*client.HTTPClient, error)
HTTPClient creates a new instance of *client.HTTPClient
type GSSAPIConfig ¶ added in v14.16.0
type GSSAPIConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
Keytab string `yaml:"keytab,omitempty"`
ServicePrincipalName string `yaml:"service_principal_name,omitempty"`
LibPath string
}
GSSAPIConfig contains GSSAPI/Kerberos authentication settings for SSH.
type HTTPSettingsConfig ¶ added in v14.40.0
type HTTPSettingsConfig struct {
User string `yaml:"user"`
Password string `yaml:"password"`
ReadTimeoutSeconds uint64 `yaml:"read_timeout"`
CaFile string `yaml:"ca_file"`
CaPath string `yaml:"ca_path"`
}
HTTPSettingsConfig are HTTP related settings
type LFSConfig ¶ added in v14.34.0
type LFSConfig struct {
PureSSHProtocol bool `yaml:"pure_ssh_protocol"`
}
LFSConfig contains Git LFS protocol settings.
type PATConfig ¶ added in v14.36.0
type PATConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
AllowedScopes []string `yaml:"allowed_scopes,omitempty"`
}
PATConfig contains Personal Access Token authentication settings.
type ServerConfig ¶
type ServerConfig struct {
Listen string `yaml:"listen,omitempty"`
ProxyProtocol bool `yaml:"proxy_protocol,omitempty"`
ProxyPolicy string `yaml:"proxy_policy,omitempty"`
ProxyAllowed []string `yaml:"proxy_allowed,omitempty"`
WebListen string `yaml:"web_listen,omitempty"`
ConcurrentSessionsLimit int64 `yaml:"concurrent_sessions_limit,omitempty"`
ClientAliveInterval YamlDuration `yaml:"client_alive_interval,omitempty"`
GracePeriod YamlDuration `yaml:"grace_period"`
ProxyHeaderTimeout YamlDuration `yaml:"proxy_header_timeout"`
LoginGraceTime YamlDuration `yaml:"login_grace_time"`
ReadinessProbe string `yaml:"readiness_probe"`
LivenessProbe string `yaml:"liveness_probe"`
HostKeyFiles []string `yaml:"host_key_files,omitempty"`
HostCertFiles []string `yaml:"host_cert_files,omitempty"`
MACs []string `yaml:"macs"`
KexAlgorithms []string `yaml:"kex_algorithms"`
PublicKeyAlgorithms []string `yaml:"public_key_algorithms"`
Ciphers []string `yaml:"ciphers"`
GSSAPI GSSAPIConfig `yaml:"gssapi,omitempty"`
}
ServerConfig contains SSH server configuration options.
type YamlDuration ¶
YamlDuration is a custom duration type that can unmarshal from both integer seconds and standard duration strings in YAML.
func (*YamlDuration) UnmarshalYAML ¶
func (d *YamlDuration) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements custom YAML unmarshaling for YamlDuration, accepting both integer seconds and duration strings.