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"`
Deps Deps `toml:"deps"`
Retention Retention `toml:"retention"`
// 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 ¶
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 ¶
CheckHost performs environment probes that only make sense on the target machine: port availability for the embedded listener and root existence.
func (Config) SiteHost ¶
SiteHost returns the bare hostname from site_url (no scheme, port, path).
type Deps ¶ added in v1.1.0
type Deps struct {
CheckIntervalHours int `toml:"check_interval_hours"`
}
Deps configures the dependency-update sweep. It runs only for repos that have opted in with `repo deps enable`, because checking a private repo tells a public registry what it depends on.
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"`
// TrustedProxies are the addresses or CIDRs of reverse proxies in front
// of this process. A request from one of them is attributed to the
// last X-Forwarded-For hop that is not itself a trusted proxy; from
// anyone else the peer address is the client and the header is
// ignored. Empty means no proxy, which is how gitbayd is deployed by
// default: it terminates TLS itself.
TrustedProxies []string `toml:"trusted_proxies,omitempty"`
}
type LFS ¶ added in v0.4.0
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"`
// APIRate is sustained JSON-API requests per minute per caller; writes
// draw on a tenth of it. 0 uses the default.
APIRate int `toml:"api_rate"`
// Per-account quotas on what a user owns directly (organizations are
// not capped). 0 means unlimited; admin user limits overrides per
// account.
MaxReposPerUser int `toml:"max_repos_per_user"`
MaxBytesPerUser int64 `toml:"max_bytes_per_user"`
}
type Mail ¶
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
// PendingExpiry is how long a self-registered account may stay
// unverified before it is removed, as a duration ("168h"). Empty
// keeps such accounts forever.
PendingExpiry string `toml:"pending_expiry"`
}
func (Registration) PendingExpiryDuration ¶ added in v1.7.0
func (r Registration) PendingExpiryDuration() time.Duration
PendingExpiryDuration parses PendingExpiry; zero means never.
type Retention ¶ added in v1.12.0
type Retention struct {
Audit string `toml:"audit"`
Events string `toml:"events"`
WebhookDeliveries string `toml:"webhook_deliveries"`
// Mail is the outbound queue: rows already sent or given up on.
Mail string `toml:"mail"`
}
Retention is how long the append-only tables keep a row. Each is a duration string ("2160h"); empty or zero keeps forever, which is what an instance that has never configured this gets. Expired sessions and tokens are swept regardless: they are dead weight the moment they expire and no setting makes them worth keeping.
type SSH ¶
type Server ¶
type Server struct {
Root string `toml:"root"`
SiteURL string `toml:"site_url"`
// SourceRepo names the repository this instance develops itself in, as
// "owner/name". When set, startup warns if the running build's commit is
// not on that repository's default branch. Empty disables the check, which
// is right for any instance that does not host its own source.
SourceRepo string `toml:"source_repo"`
}
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"`
}
Source Files
¶
- config.go