1package config23import (4 "bytes"5 "text/template"6)78var configFileTmpl = template.Must(template.New("config").Parse(`# Soft Serve Server configurations910# The name of the server.11# This is the name that will be displayed in the UI.12name: "{{ .Name }}"1314# Logging configuration.15log:16 # Log format to use. Valid values are "json", "logfmt", and "text".17 format: "{{ .Log.Format }}"18 # Time format for the log "timestamp" field.19 # Should be described in Golang's time format.20 time_format: "{{ .Log.TimeFormat }}"21 # Path to the log file. Leave empty to write to stderr.22 #path: "{{ .Log.Path }}"2324# The SSH server configuration.25ssh:26 # Enable SSH.27 enabled: {{ .SSH.Enabled }}2829 # The address on which the SSH server will listen.30 listen_addr: "{{ .SSH.ListenAddr }}"3132 # The public URL of the SSH server.33 # This is the address that will be used to clone repositories.34 public_url: "{{ .SSH.PublicURL }}"3536 # The path to the SSH server's private key.37 key_path: {{ .SSH.KeyPath }}3839 # The path to the server's client private key. This key will be used to40 # authenticate the server to make git requests to ssh remotes.41 client_key_path: {{ .SSH.ClientKeyPath }}4243 # The maximum number of seconds a connection can take.44 # A value of 0 means no timeout.45 max_timeout: {{ .SSH.MaxTimeout }}4647 # The number of seconds a connection can be idle before it is closed.48 # A value of 0 means no timeout.49 idle_timeout: {{ .SSH.IdleTimeout }}5051# The Git daemon configuration.52git:53 # Enable the Git daemon.54 enabled: {{ .Git.Enabled }}5556 # The address on which the Git daemon will listen.57 listen_addr: "{{ .Git.ListenAddr }}"5859 # The public URL of the Git daemon server.60 # This is the address that will be used to clone repositories.61 public_url: "{{ .Git.PublicURL }}"6263 # The maximum number of seconds a connection can take.64 # A value of 0 means no timeout.65 max_timeout: {{ .Git.MaxTimeout }}6667 # The number of seconds a connection can be idle before it is closed.68 idle_timeout: {{ .Git.IdleTimeout }}6970 # The maximum number of concurrent connections.71 max_connections: {{ .Git.MaxConnections }}7273# The HTTP server configuration.74http:75 # Enable the HTTP server.76 enabled: {{ .HTTP.Enabled }}7778 # The address on which the HTTP server will listen.79 listen_addr: "{{ .HTTP.ListenAddr }}"8081 # The path to the TLS private key.82 tls_key_path: {{ .HTTP.TLSKeyPath }}8384 # The path to the TLS certificate.85 tls_cert_path: {{ .HTTP.TLSCertPath }}8687 # The public URL of the HTTP server.88 # This is the address that will be used to clone repositories.89 # Make sure to use https:// if you are using TLS.90 public_url: "{{ .HTTP.PublicURL }}"9192 # The cross-origin request security options93 cors:94 # The allowed cross-origin headers95 allowed_headers:96 - "Accept"97 - "Accept-Language"98 - "Content-Language"99 - "Content-Type"100 - "Origin"101 - "X-Requested-With"102 - "User-Agent"103 - "Authorization"104 - "Access-Control-Request-Method"105 - "Access-Control-Allow-Origin"106 # The allowed cross-origin URLs107 allowed_origins:108 - "{{ .HTTP.PublicURL }}" # always allowed109 # - "https://example.com"110 # The allowed cross-origin methods111 allowed_methods:112 - "GET"113 - "HEAD"114 - "POST"115 - "PUT"116 - "OPTIONS"117118# The stats server configuration.119stats:120 # Enable the stats server.121 enabled: {{ .Stats.Enabled }}122123 # The address on which the stats server will listen.124 listen_addr: "{{ .Stats.ListenAddr }}"125126# The database configuration.127db:128 # The database driver to use.129 # Valid values are "sqlite" and "postgres".130 driver: "{{ .DB.Driver }}"131 # The database data source name.132 # This is driver specific and can be a file path or connection string.133 # Make sure foreign key support is enabled when using SQLite.134 data_source: "{{ .DB.DataSource }}"135136# Git LFS configuration.137lfs:138 # Enable Git LFS.139 enabled: {{ .LFS.Enabled }}140 # Enable Git SSH transfer.141 ssh_enabled: {{ .LFS.SSHEnabled }}142143# Cron job configuration144jobs:145 mirror_pull: "{{ .Jobs.MirrorPull }}"146147# Additional admin keys.148#initial_admin_keys:149# - "ssh-rsa AAAAB3NzaC1yc2..."150`))151152func newConfigFile(cfg *Config) string {153 var b bytes.Buffer154 configFileTmpl.Execute(&b, cfg) // nolint: errcheck155 return b.String()156}