config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate added in v0.1.11

func Validate(cfg *Config) error

Validate performs runtime validations on the loaded configuration.

Types

type Config

type Config struct {
	ServerAddress string `env:"SERVER_ADDRESS" envDefault:":8080"`
	MCPPort       uint16 `env:"MCP_PORT" envDefault:"0"`
	DatabaseURL   string `env:"DATABASE_URL" envDefault:"postgres://agentregistry:agentregistry@localhost:5432/agentregistry?sslmode=disable"`
	Version       string `env:"VERSION" envDefault:"dev"`
	LogLevel      string `env:"LOG_LEVEL" envDefault:"info"`

	// Platform mode: "docker" or "kubernetes". Controls which deployment
	// provider IDs are available in the UI. Defaults to "kubernetes" so
	// Helm/K8s deployments work without extra config;
	// docker/docker-compose.yml explicitly sets this to "docker".
	PlatformMode string `env:"PLATFORM_MODE" envDefault:"kubernetes"`

	// Agent Gateway Configuration
	AgentGatewayPort uint16 `env:"AGENT_GATEWAY_PORT" envDefault:"8081"`

	// Runtime Configuration
	RuntimeDir string `env:"RUNTIME_DIR" envDefault:"/tmp/arctl-runtime"`
	Verbose    bool   `env:"VERBOSE" envDefault:"false"`

	// MCP Registry compatibility (read-only)
	//
	// MCPRegistryCompatEnabled toggles the read-only MCP Registry v0.1
	// compatibility API (GET /v0.1/servers ...), which re-exposes MCPServer
	// resources in the official server.json shape so registry-aware clients
	// (e.g. VS Code's MCP gallery) can discover them. The endpoint is
	// anonymous and flattens every namespace into one catalogue, and it
	// bypasses per-kind RBAC list filters, so it is OFF by default — enable
	// it only where an unauthenticated, cross-namespace MCP catalogue is
	// acceptable (a public OSS registry, or behind a trusted gateway).
	MCPRegistryCompatEnabled bool `env:"MCP_REGISTRY_COMPAT_ENABLED" envDefault:"false"`
	// MCPRegistryCompatPathPrefix optionally mounts the compatibility API
	// under a base prefix (e.g. "/mcp-registry"); empty serves the spec's
	// standard paths at the root. Clients append "/v0.1/servers" to the base
	// URL they're configured with, so any prefix set here must match that
	// configured base.
	MCPRegistryCompatPathPrefix string `env:"MCP_REGISTRY_COMPAT_PATH_PREFIX" envDefault:""`

	// ControllerEventRetention is how long handled control-plane events remain
	// available for checkpoint replay. Set to 0 to disable event pruning.
	ControllerEventRetention time.Duration `env:"CONTROLLER_EVENT_RETENTION" envDefault:"24h"`
	// ControllerEventKeepAfterRevision preserves control-plane events newer than
	// this Postgres revision even when they are older than ControllerEventRetention.
	ControllerEventKeepAfterRevision int64 `env:"CONTROLLER_EVENT_KEEP_AFTER_REVISION" envDefault:"0"`
	// ControllerRetentionPruneBatchLimit caps rows removed per retention pass so
	// pruning cannot monopolize the database during startup or repair loops.
	ControllerRetentionPruneBatchLimit int `env:"CONTROLLER_RETENTION_PRUNE_BATCH_LIMIT" envDefault:"500"`
	// ControllerDiscoveryInterval is how often provider discovery snapshots are
	// materialized into discovered Deployment rows. Provider-specific cache
	// refreshes may have separate intervals.
	ControllerDiscoveryInterval time.Duration `env:"CONTROLLER_DISCOVERY_INTERVAL" envDefault:"60s"`
	// ControllerDiscoveryStaleAfterMisses is how many consecutive successful
	// discovery polls may omit a discovered Deployment before it is marked
	// not-ready/stale.
	ControllerDiscoveryStaleAfterMisses int `env:"CONTROLLER_DISCOVERY_STALE_AFTER_MISSES" envDefault:"3"`
	// ControllerDiscoveryDeleteAfterMisses is how many consecutive successful
	// discovery polls may omit a discovered Deployment before it is deleted.
	ControllerDiscoveryDeleteAfterMisses int `env:"CONTROLLER_DISCOVERY_DELETE_AFTER_MISSES" envDefault:"5"`

	// SkipMigrations gates the server's Postgres migrator at startup.
	// Set true when migrations are applied out-of-band (e.g. by
	// `arctl db migrate up` from CI/CD ahead of the rollout).
	// Populated from the unprefixed SKIP_MIGRATIONS env var (see
	// NewConfig) — deliberately prefix-free so the same name toggles
	// the gate across binaries regardless of their env prefix.
	// AppOptions.SkipMigrations wins over this env value when set
	// programmatically.
	SkipMigrations bool `env:"-"`
}

Config holds the application configuration See .env.example for more documentation

func NewConfig

func NewConfig() *Config

NewConfig creates a new configuration with default values.

Server-only entry point: NewConfig is called from registry.App() at server start; arctl does not call NewConfig, so the os.Exit(1) branches below (caarlos0/env parse failure and the SKIP_MIGRATIONS parse) cannot fire during CLI invocations like `arctl db migrate`.

Jump to

Keyboard shortcuts

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