config

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: 0BSD Imports: 7 Imported by: 0

Documentation

Overview

Package config loads and validates the gitbayd server configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Enabled bool `toml:"enabled"`
}

API controls the HTTPS/JSON control-plane API (bearer tokens minted over SSH). Off by default: an instance that never enables it has no credential-bearing HTTP surface at all.

type Config

type Config struct {
	Server       Server       `toml:"server"`
	SSH          SSH          `toml:"ssh"`
	HTTP         HTTP         `toml:"http"`
	GitDaemon    GitDaemon    `toml:"git_daemon"`
	Web          Web          `toml:"web"`
	Registration Registration `toml:"registration"`
	API          API          `toml:"api"`
	Webhooks     Webhooks     `toml:"webhooks"`
	Pages        Pages        `toml:"pages"`
	LFS          LFS          `toml:"lfs"`
	Limits       Limits       `toml:"limits"`
	Mail         Mail         `toml:"mail"`
	Mirrors      Mirrors      `toml:"mirrors"`
	// GoImport maps vanity Go module paths to repositories, e.g.
	// "gitbay.org/gitbay" = "krz/gitbay". Requests carrying ?go-get=1
	// under a mapped path get a go-import meta tag.
	GoImport map[string]string `toml:"go_import"`
}

func Default

func Default() Config

Default returns the configuration used when a key is absent from the file.

func Load

func Load(path string) (Config, error)

Load reads path, applies defaults, and validates. It does not probe the host (see CheckHost) so it is safe in tests and on non-target machines.

func (Config) CheckHost

func (c Config) CheckHost() error

CheckHost performs environment probes that only make sense on the target machine: port availability for the embedded listener and root existence.

func (Config) SiteHost

func (c Config) SiteHost() string

SiteHost returns the bare hostname from site_url (no scheme, port, path).

func (Config) Validate

func (c Config) Validate() error

Validate applies the static contradiction checks from the plan.

type GitDaemon

type GitDaemon struct {
	Enabled bool `toml:"enabled"`
	Port    int  `toml:"port"`
}

type HTTP

type HTTP struct {
	Addr     string `toml:"addr"`
	TLS      string `toml:"tls"` // acme | files | off
	CertFile string `toml:"cert_file"`
	KeyFile  string `toml:"key_file"`
	// ACME (Let's Encrypt by default). Certificates are cached under
	// server.root/acme. acme_http_addr serves HTTP-01 challenges and
	// redirects to HTTPS; "off" disables it (TLS-ALPN-01 on the HTTPS
	// port still works).
	ACMEEmail    string `toml:"acme_email"`
	ACMEHTTPAddr string `toml:"acme_http_addr"`
}

type LFS added in v0.4.0

type LFS struct {
	Root           string `toml:"root"`
	MaxObjectBytes int64  `toml:"max_object_bytes"`
}

LFS stores large-file objects content-addressed under Root (default <server.root>/lfs). MaxObjectBytes caps a single object; 0 means the 512MB default.

type Limits

type Limits struct {
	MaxPackBytes    int64 `toml:"max_pack_bytes"`
	MaxBlobBytes    int64 `toml:"max_blob_bytes"`
	MaxAssetBytes   int64 `toml:"max_asset_bytes"` // per release asset
	CloneTimeoutSec int   `toml:"clone_timeout"`
	SSHAuthRate     int   `toml:"ssh_auth_rate"`
}

type Mail

type Mail struct {
	SMTPHost string `toml:"smtp_host"` // host:port (port defaults to 587)
	From     string `toml:"from"`
	SMTPUser string `toml:"smtp_user,omitempty"`
	SMTPPass string `toml:"smtp_pass,omitempty"`
}

type Mirrors added in v0.2.0

type Mirrors struct {
	PullIntervalMinutes int `toml:"pull_interval_minutes"`
}

type Pages added in v0.3.0

type Pages struct {
	Domain string `toml:"domain"`
}

Pages serves each public repo's `pages` branch as a static site on <owner>.<domain> — a separate origin, so page-authored scripts never run on the forge's own host. Empty domain disables the feature.

type Registration

type Registration struct {
	Mode string `toml:"mode"` // closed | invite | open
}

type SSH

type SSH struct {
	Mode     string   `toml:"mode"` // embedded | system
	Port     int      `toml:"port"`
	HostKeys []string `toml:"host_keys"`
}

type Server

type Server struct {
	Root    string `toml:"root"`
	SiteURL string `toml:"site_url"`
}

type Web

type Web struct {
	Mode         string `toml:"mode"` // view_only | accounts
	PasswordAuth bool   `toml:"password_auth"`
	// Title is the instance's display name in the header and page titles.
	// Empty falls back to the site host.
	Title string `toml:"title"`
	// PrivacyNotice is operator-provided text shown on /privacy under the
	// fixed project-level statement. Plain text; blank paragraphs split.
	PrivacyNotice string `toml:"privacy_notice"`
}

type Webhooks

type Webhooks struct {
	AllowLocal bool `toml:"allow_local"`
}

Webhooks controls outbound delivery. AllowLocal permits endpoints on loopback/private addresses (off by default: SSRF).

Source Files

  • config.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL