1package config
2
3import "strconv"
4
5// GitDaemonConfig is the Git daemon configuration for the server.
6type GitDaemonConfig struct {
7 // ListenAddr is the address on which the Git daemon will listen.
8 ListenAddr string `env:"LISTEN_ADDR" yaml:"listen_addr"`
9
10 // MaxTimeout is the maximum number of seconds a connection can take.
11 MaxTimeout int `env:"MAX_TIMEOUT" yaml:"max_timeout"`
12
13 // IdleTimeout is the number of seconds a connection can be idle before it is closed.
14 IdleTimeout int `env:"IDLE_TIMEOUT" yaml:"idle_timeout"`
15
16 // MaxConnections is the maximum number of concurrent connections.
17 MaxConnections int `env:"MAX_CONNECTIONS" yaml:"max_connections"`
18}
19
20// Environ returns the environment variables for the config.
21func (g GitDaemonConfig) Environ() []string {
22 return []string{
23 "SOFT_SERVE_GIT_DAEMON_LISTEN_ADDR=" + g.ListenAddr,
24 "SOFT_SERVE_GIT_DAEMON_MAX_TIMEOUT=" + strconv.Itoa(g.MaxTimeout),
25 "SOFT_SERVE_GIT_DAEMON_IDLE_TIMEOUT=" + strconv.Itoa(g.IdleTimeout),
26 "SOFT_SERVE_GIT_DAEMON_MAX_CONNECTIONS=" + strconv.Itoa(g.MaxConnections),
27 }
28}