hubconfig

package
v0.172.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package hubconfig reads the optional `hub:` section of ~/.config/wb/wb.yaml, which turns `wb daemon serve` into the self-hosting unit for bench.

The section is absent for every operator who does not self-host, so Load reports "found" separately from an error: a missing file and a missing section are both (Config{}, false, nil), and only a present-but-invalid section is an error. That keeps the daemon's behaviour byte-identical without `hub:`, which is what spec/features/self-hosted-bench promises.

Secrets are always file paths. A token, private key, or webhook secret never appears in the configuration value itself, matching remote.token_file.

Index

Constants

View Source
const (
	EngineMemory      = "memory"
	EngineInGitDB     = "ingitdb"
	EngineOpenVaultDB = "openvaultdb"
)

Engine names the DALgo engine the hub's document store runs on.

View Source
const (
	DefaultPollInterval = 20 * time.Minute
	MinimumPollInterval = 30 * time.Second
)

DefaultPollInterval and MinimumPollInterval bound the GitHub poller. The default is deliberately slow: polling costs two GitHub API calls per repository per tick against a per-user hourly budget of 5000, and a fleet of a few hundred repositories on a one-minute interval drains that budget in minutes for every tool the operator runs (founder ruling 2026-09-11, after exactly that happened). Push latency comes from webhook mode, not from a short interval.

View Source
const ConfigSnippet = `` /* 174-byte string literal not displayed */

ConfigSnippet is printed by callers that need the minimal self-hosting section, so the fix is copy-paste rather than documentation lookup.

Variables

This section is empty.

Functions

func DefaultStorePath

func DefaultStorePath() string

DefaultStorePath returns ~/.wb/hub, the inGitDB project directory a self-hoster gets without saying anything.

Types

type App

type App struct {
	AppID             int64  `yaml:"app_id"`
	PrivateKeyFile    string `yaml:"private_key_file"`
	WebhookSecretFile string `yaml:"webhook_secret_file"`
	PublicURL         string `yaml:"public_url"`
}

App is the optional GitHub App that switches covered repositories from polling to webhooks. Every field is required once the block is present: a half-configured App would accept deliveries it cannot verify.

type Config

type Config struct {
	Store  Store  `yaml:"store"`
	GitHub GitHub `yaml:"github"`
}

Config is the hub section of ~/.config/wb/wb.yaml.

func Load

func Load(path string) (Config, bool, error)

Load reads the hub section from path. A missing file or a missing section is (Config{}, false, nil); a present but invalid section is an error.

func (Config) Location

func (c Config) Location() string

Location describes where the hub keeps its state, for status output and the one line the daemon prints on start.

type GitHub

type GitHub struct {
	TokenFile    string        `yaml:"token_file"`
	PollInterval time.Duration `yaml:"poll_interval"`
	App          *App          `yaml:"app"`
}

GitHub configures the ingester. TokenFile alone is enough to poll.

type Store

type Store struct {
	Engine string `yaml:"engine"`
	// Path is the inGitDB project directory. Ignored by the other engines.
	Path string `yaml:"path"`
	// URL is the OpenVaultDB server origin. Ignored by the other engines.
	URL string `yaml:"url"`
	// DatabaseID names the OpenVaultDB database. Optional; defaults to "wb".
	DatabaseID string `yaml:"database_id"`
}

Store selects and locates the hub's document store.

Jump to

Keyboard shortcuts

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