1package config
2
3import (
4 "bytes"
5 "text/template"
6)
7
8var (
9 configFileTmpl = template.Must(template.New("config").Parse(`# Soft Serve Server configurations
10
11# The name of the server.
12# This is the name that will be displayed in the UI.
13name: "{{ .Name }}"
14
15# Log format to use. Valid values are "json", "logfmt", and "text".
16log_format: "{{ .LogFormat }}"
17
18# The SSH server configuration.
19ssh:
20 # The address on which the SSH server will listen.
21 listen_addr: "{{ .SSH.ListenAddr }}"
22
23 # The public URL of the SSH server.
24 # This is the address that will be used to clone repositories.
25 public_url: "{{ .SSH.PublicURL }}"
26
27 # The path to the SSH server's private key.
28 key_path: "{{ .SSH.KeyPath }}"
29
30 # The path to the server's client private key. This key will be used to
31 # authenticate the server to make git requests to ssh remotes.
32 client_key_path: "{{ .Internal.ClientKeyPath }}"
33
34 # The maximum number of seconds a connection can take.
35 # A value of 0 means no timeout.
36 max_timeout: {{ .SSH.MaxTimeout }}
37
38 # The number of seconds a connection can be idle before it is closed.
39 # A value of 0 means no timeout.
40 idle_timeout: {{ .SSH.IdleTimeout }}
41
42# The Git daemon configuration.
43git:
44 # The address on which the Git daemon will listen.
45 listen_addr: "{{ .Git.ListenAddr }}"
46
47 # The maximum number of seconds a connection can take.
48 # A value of 0 means no timeout.
49 max_timeout: {{ .Git.MaxTimeout }}
50
51 # The number of seconds a connection can be idle before it is closed.
52 idle_timeout: {{ .Git.IdleTimeout }}
53
54 # The maximum number of concurrent connections.
55 max_connections: {{ .Git.MaxConnections }}
56
57# The HTTP server configuration.
58http:
59 # The address on which the HTTP server will listen.
60 listen_addr: "{{ .HTTP.ListenAddr }}"
61
62 # The path to the TLS private key.
63 tls_key_path: "{{ .HTTP.TLSKeyPath }}"
64
65 # The path to the TLS certificate.
66 tls_cert_path: "{{ .HTTP.TLSCertPath }}"
67
68 # The public URL of the HTTP server.
69 # This is the address that will be used to clone repositories.
70 # Make sure to use https:// if you are using TLS.
71 public_url: "{{ .HTTP.PublicURL }}"
72
73# The stats server configuration.
74stats:
75 # The address on which the stats server will listen.
76 listen_addr: "{{ .Stats.ListenAddr }}"
77
78# Additional admin keys.
79#initial_admin_keys:
80# - "ssh-rsa AAAAB3NzaC1yc2..."
81`))
82)
83
84func newConfigFile(cfg *Config) string {
85 var b bytes.Buffer
86 configFileTmpl.Execute(&b, cfg) // nolint: errcheck
87 return b.String()
88}