Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithContext ¶ added in v0.5.0
WithContext returns a new context with the configuration attached.
func WriteConfig ¶ added in v0.5.0
WriteConfig writes the configuration to the given file.
Types ¶
type Config ¶
type Config struct {
// Name is the name of the server.
Name string `env:"NAME" yaml:"name"`
// SSH is the configuration for the SSH server.
SSH SSHConfig `envPrefix:"SSH_" yaml:"ssh"`
// Git is the configuration for the Git daemon.
Git GitConfig `envPrefix:"GIT_" yaml:"git"`
// HTTP is the configuration for the HTTP server.
HTTP HTTPConfig `envPrefix:"HTTP_" yaml:"http"`
// Stats is the configuration for the stats server.
Stats StatsConfig `envPrefix:"STATS_" yaml:"stats"`
// LogFormat is the format of the logs.
// Valid values are "json", "logfmt", and "text".
LogFormat string `env:"LOG_FORMAT" yaml:"log_format"`
// InitialAdminKeys is a list of public keys that will be added to the list of admins.
InitialAdminKeys []string `env:"INITIAL_ADMIN_KEYS" envSeparator:"\n" yaml:"initial_admin_keys"`
// DataPath is the path to the directory where Soft Serve will store its data.
DataPath string `env:"DATA_PATH" yaml:"-"`
// Backend is the Git backend to use.
Backend backend.Backend `yaml:"-"`
}
Config is the configuration for Soft Serve.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with the values populated with the defaults or specified environment variables.
func FromContext ¶ added in v0.5.0
FromContext returns the configuration from the context.
func ParseConfig ¶ added in v0.5.0
ParseConfig parses the configuration from the given file.
type GitConfig ¶ added in v0.5.0
type GitConfig struct {
// ListenAddr is the address on which the Git daemon will listen.
ListenAddr string `env:"LISTEN_ADDR" yaml:"listen_addr"`
// MaxTimeout is the maximum number of seconds a connection can take.
MaxTimeout int `env:"MAX_TIMEOUT" yaml:"max_timeout"`
// IdleTimeout is the number of seconds a connection can be idle before it is closed.
IdleTimeout int `env:"IDLE_TIMEOUT" yaml:"idle_timeout"`
// MaxConnections is the maximum number of concurrent connections.
MaxConnections int `env:"MAX_CONNECTIONS" yaml:"max_connections"`
}
GitConfig is the Git daemon configuration for the server.
type HTTPConfig ¶ added in v0.5.0
type HTTPConfig struct {
// ListenAddr is the address on which the HTTP server will listen.
ListenAddr string `env:"LISTEN_ADDR" yaml:"listen_addr"`
// TLSKeyPath is the path to the TLS private key.
TLSKeyPath string `env:"TLS_KEY_PATH" yaml:"tls_key_path"`
// TLSCertPath is the path to the TLS certificate.
TLSCertPath string `env:"TLS_CERT_PATH" yaml:"tls_cert_path"`
// PublicURL is the public URL of the HTTP server.
PublicURL string `env:"PUBLIC_URL" yaml:"public_url"`
}
HTTPConfig is the HTTP configuration for the server.
type SSHConfig ¶ added in v0.5.0
type SSHConfig struct {
// ListenAddr is the address on which the SSH server will listen.
ListenAddr string `env:"LISTEN_ADDR" yaml:"listen_addr"`
// PublicURL is the public URL of the SSH server.
PublicURL string `env:"PUBLIC_URL" yaml:"public_url"`
// KeyPath is the path to the SSH server's private key.
KeyPath string `env:"KEY_PATH" yaml:"key_path"`
// ClientKeyPath is the path to the server's client private key.
ClientKeyPath string `env:"CLIENT_KEY_PATH" yaml:"client_key_path"`
// MaxTimeout is the maximum number of seconds a connection can take.
MaxTimeout int `env:"MAX_TIMEOUT" yaml:"max_timeout"`
// IdleTimeout is the number of seconds a connection can be idle before it is closed.
IdleTimeout int `env:"IDLE_TIMEOUT" yaml:"idle_timeout"`
}
SSHConfig is the configuration for the SSH server.
type StatsConfig ¶ added in v0.5.0
type StatsConfig struct {
// ListenAddr is the address on which the stats server will listen.
ListenAddr string `env:"LISTEN_ADDR" yaml:"listen_addr"`
}
StatsConfig is the configuration for the stats server.
Click to show internal directories.
Click to hide internal directories.