config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config provides centralized configuration management for the Gonimbus service. It implements the three-layer config pattern using gofulmen/config: Layer 1: Crucible defaults (config/gonimbus/v1.0.0/gonimbus-defaults.yaml) Layer 2: User overrides (discovered via app identity) Layer 3: Environment variables and runtime overrides

Index

Constants

View Source
const (
	EnvString = gfconfig.EnvString
	EnvInt    = gfconfig.EnvInt
	EnvBool   = gfconfig.EnvBool
)

Environment variable types

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server  ServerConfig  `mapstructure:"server"`
	Logging LoggingConfig `mapstructure:"logging"`
	Metrics MetricsConfig `mapstructure:"metrics"`
	Health  HealthConfig  `mapstructure:"health"`
	Debug   DebugConfig   `mapstructure:"debug"`
	Workers int           `mapstructure:"workers"`
	// DataRoot optionally relocates gonimbus operational state. DataDir is
	// accepted as a compatibility alias; DataRoot wins when both are set.
	DataRoot string `mapstructure:"data_root"`
	DataDir  string `mapstructure:"data_dir"`
	// HubReadHandles are logical read-only hub bindings used by exact acquisition
	// and as custody bridge sources. The resolved provider capability never
	// crosses into the configuration-free libraries as this structure or as a
	// handle name.
	HubReadHandles map[string]HubReadHandleConfig `mapstructure:"hub_read_handles"`
	// HubPublishHandles are logical exact-read plus conditional-create bindings
	// used by custody bridge publication. They deliberately do not grant list,
	// overwrite, delete, or destination-administration authority.
	HubPublishHandles map[string]HubPublishHandleConfig `mapstructure:"hub_publish_handles"`
}

Config represents the complete application configuration following the Fulmen Forge Workhorse Standard three-layer pattern: Layer 1: Crucible defaults (config/gonimbus-defaults.yaml) Layer 2: User overrides (~/.config/gonimbus/config.yaml) Layer 3: Environment variables and runtime overrides

func GetConfig

func GetConfig() *Config

GetConfig returns the current application configuration (thread-safe)

func Load

func Load(ctx context.Context, runtimeOverrides ...map[string]any) (*Config, error)

Load loads configuration using the three-layer pattern: 1. Crucible defaults from config/gonimbus-defaults.yaml 2. User overrides from XDG config paths 3. Environment variables and runtime overrides

This function is safe to call multiple times (e.g., for config reload)

type DebugConfig

type DebugConfig struct {
	// Enabled controls whether debug mode is active
	Enabled bool `mapstructure:"enabled"`

	// PprofEnabled controls whether pprof endpoints are exposed
	// WARNING: Only enable in development/staging environments
	PprofEnabled bool `mapstructure:"pprof_enabled"`
}

DebugConfig contains debug and profiling configuration

type EnvVarSpec

type EnvVarSpec = gfconfig.EnvVarSpec

EnvVarSpec defines environment variable mappings for config fields following the pattern: {PREFIX}{NAME} maps to config path

type HealthConfig

type HealthConfig struct {
	// Enabled controls whether health endpoints are exposed
	Enabled bool `mapstructure:"enabled"`
}

HealthConfig contains health check configuration

type HubPublishHandleConfig

type HubPublishHandleConfig struct {
	URI        string `mapstructure:"uri"`
	Profile    string `mapstructure:"profile"`
	Region     string `mapstructure:"region"`
	Endpoint   string `mapstructure:"endpoint"`
	GCPProject string `mapstructure:"gcp_project"`
}

HubPublishHandleConfig binds a logical config-plane name to one create-only hub root and provider credential selection.

type HubReadHandleConfig

type HubReadHandleConfig struct {
	URI        string `mapstructure:"uri"`
	Profile    string `mapstructure:"profile"`
	Region     string `mapstructure:"region"`
	Endpoint   string `mapstructure:"endpoint"`
	GCPProject string `mapstructure:"gcp_project"`
}

HubReadHandleConfig binds a logical config-plane name to one hub root and provider read credential selection.

type LoggingConfig

type LoggingConfig struct {
	// Level controls the minimum log level
	// Valid values: trace, debug, info, warn, error
	Level string `mapstructure:"level"`

	// Profile selects the logging complexity level
	// Valid values: SIMPLE, STRUCTURED, ENTERPRISE
	// See: gofulmen/docs/crucible-go/standards/observability/logging.md
	Profile string `mapstructure:"profile"`
}

LoggingConfig contains logging configuration Supports progressive logging profiles per Fulmen Forge Workhorse Standard: - SIMPLE: Console output only, minimal configuration (CLI tools) - STRUCTURED: Structured sinks, correlation IDs (API services) - ENTERPRISE: Multiple sinks, middleware, throttling, policy enforcement (production)

type MetricsConfig

type MetricsConfig struct {
	// Enabled controls whether metrics are exposed
	Enabled bool `mapstructure:"enabled"`

	// Port is the dedicated metrics endpoint port (Prometheus format)
	// Metrics are also available at the main HTTP port in JSON format
	Port int `mapstructure:"port"`
}

MetricsConfig contains Prometheus metrics configuration

type ServerConfig

type ServerConfig struct {
	Host            string        `mapstructure:"host"`
	Port            int           `mapstructure:"port"`
	ReadTimeout     time.Duration `mapstructure:"read_timeout"`
	WriteTimeout    time.Duration `mapstructure:"write_timeout"`
	IdleTimeout     time.Duration `mapstructure:"idle_timeout"`
	ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout"`
}

ServerConfig contains HTTP server configuration

Jump to

Keyboard shortcuts

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