config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config provides environment-based configuration for handler services with optional live reload of secrets and service endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	// Service identification (immutable)
	ServiceName      string
	ServiceVersion   string
	ServiceNamespace string
	DeploymentEnv    string

	// NATS configuration (immutable)
	NATSURL        string
	NATSUser       string
	NATSPassword   string
	NATSQueueGroup string

	// Redis/Valkey configuration (immutable)
	RedisURL      string
	RedisPassword string

	// Milvus configuration (immutable)
	MilvusHost       string
	MilvusPort       int
	MilvusCollection string

	// OpenTelemetry configuration (immutable)
	OTELEnabled  bool
	OTELEndpoint string
	OTELUseHTTP  bool

	// HyperDX configuration (immutable)
	HyperDXEnabled  bool
	HyperDXAPIKey   string
	HyperDXEndpoint string

	// MLflow configuration (immutable)
	MLflowTrackingURI    string
	MLflowExperimentName string
	MLflowEnabled        bool

	// Health check configuration (immutable)
	HealthPort int
	HealthPath string
	ReadyPath  string

	// Timeouts (immutable)
	HTTPTimeout time.Duration
	NATSTimeout time.Duration

	// Secrets path for file-based hot reload (Kubernetes secret mounts)
	SecretsPath string
	// contains filtered or unexported fields
}

Settings holds base configuration for all handler services. Fields in the "hot-reload" section are protected by a RWMutex and can be updated at runtime via WatchSecrets(). All other fields are immutable after Load() returns.

func Load

func Load() *Settings

Load creates a Settings populated from environment variables with defaults.

func (*Settings) EmbeddingsURL

func (s *Settings) EmbeddingsURL() string

EmbeddingsURL returns the current embeddings service URL (thread-safe).

func (*Settings) LLMURL

func (s *Settings) LLMURL() string

LLMURL returns the current LLM service URL (thread-safe).

func (*Settings) RerankerURL

func (s *Settings) RerankerURL() string

RerankerURL returns the current reranker service URL (thread-safe).

func (*Settings) STTURL

func (s *Settings) STTURL() string

STTURL returns the current STT service URL (thread-safe).

func (*Settings) TTSURL

func (s *Settings) TTSURL() string

TTSURL returns the current TTS service URL (thread-safe).

func (*Settings) WatchSecrets

func (s *Settings) WatchSecrets(ctx context.Context)

WatchSecrets watches the SecretsPath directory for changes and reloads hot-reloadable fields. Blocks until ctx is cancelled.

Jump to

Keyboard shortcuts

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