config

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides the configuration for the opampcommander application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCacheSettings added in v0.1.30

type AgentCacheSettings struct {
	// Enabled indicates whether the agent cache is enabled.
	// Default: true
	Enabled bool `mapstructure:"enabled"`
	// TTL is the time-to-live for cache entries.
	// Default: 30s
	TTL time.Duration `mapstructure:"ttl"`
	// MaxCapacity is the maximum number of items in the cache.
	// When exceeded, least recently used items are evicted.
	// Default: 1000
	MaxCapacity int64 `mapstructure:"maxCapacity"`
}

AgentCacheSettings holds the configuration for agent cache.

type BootstrapSettings added in v0.1.41

type BootstrapSettings struct {
	// Dir is the directory of initial manifest YAML files applied on startup.
	// When empty, manifest reconciliation is skipped (e.g. tests).
	Dir string
	// DefaultNamespace is the namespace an agent is placed in when it does not
	// report a service.namespace identifying attribute. It is also the namespace
	// in which the built-in default role is auto-granted to every user.
	DefaultNamespace string
	// DefaultRole is the name of the built-in role auto-granted to every user.
	DefaultRole string
}

BootstrapSettings configures how the server seeds built-in resources on startup.

On every start the server reconciles the YAML manifests found under Dir into the persistence layer declaratively (full overwrite): the manifests are the source of truth, so changes made to built-in resources via the API are reset to match them. The default namespace/role names below are the runtime identifiers the server uses for agent namespace defaulting and the built-in default-role grant; they should match the names declared in the manifests.

type CacheSettings added in v0.1.30

type CacheSettings struct {
	// Agent cache settings
	Agent AgentCacheSettings `mapstructure:"agent"`
}

CacheSettings holds the configuration for in-memory caching.

func DefaultCacheSettings added in v0.1.30

func DefaultCacheSettings() CacheSettings

DefaultCacheSettings returns the default cache settings.

type DatabaseSettings added in v0.1.6

type DatabaseSettings struct {
	Type           DatabaseType
	Endpoints      []string
	ConnectTimeout time.Duration
	DatabaseName   string

	DDLAuto bool
}

DatabaseSettings holds the settings for database connections.

type DatabaseType added in v0.1.6

type DatabaseType string

DatabaseType represents the type of database to be used.

const (
	// DatabaseTypeMongoDB represents a MongoDB database.
	DatabaseTypeMongoDB DatabaseType = "mongodb"
	// DatabaseTypeInMemory represents an in-memory database used for standalone
	// (single-node, no external dependency) mode. Data is not persisted across
	// restarts.
	DatabaseTypeInMemory DatabaseType = "inmemory"
)

type EventProtocolType added in v0.1.22

type EventProtocolType string

EventProtocolType represents the type of event protocol.

const (
	// EventProtocolTypeInMemory represents the in-memory event protocol for standalone mode.
	EventProtocolTypeInMemory EventProtocolType = "inmemory"
	// EventProtocolTypeKafka represents the Kafka event protocol for distributed mode.
	EventProtocolTypeKafka EventProtocolType = "kafka"
)

func (EventProtocolType) String added in v0.1.22

func (e EventProtocolType) String() string

String returns the string representation of the EventProtocolType.

type EventSettings added in v0.1.22

type EventSettings struct {
	// ProtocolType is the event protocol type.
	ProtocolType EventProtocolType

	// KafkaSettings represents the Kafka configuration.
	KafkaSettings KafkaSettings
}

EventSettings represents the event settings.

type KafkaSettings added in v0.1.22

type KafkaSettings struct {
	// Brokers is the list of Kafka broker addresses.
	Brokers []string
	// Topic is the Kafka topic name for events.
	Topic string
}

KafkaSettings represents the Kafka event settings.

type ManagementSettings added in v0.1.22

type ManagementSettings struct {
	// Address is the address to bind the management server to.
	// e.g. ":9090" or "localhost:9090"
	Address string

	// Observability holds the settings for observability features. The concrete
	// type is owned by the observability package; config only aggregates it.
	Observability observability.Config
}

ManagementSettings holds the settings for the management server.

type ServerSettings

type ServerSettings struct {
	Address            string
	ServerID           agentmodel.ServerID
	DatabaseSettings   DatabaseSettings
	Security           security.Config
	ManagementSettings ManagementSettings
	EventSettings      EventSettings
	CacheSettings      CacheSettings
	BootstrapSettings  BootstrapSettings
	RBACModelPath      string
}

ServerSettings is a struct that holds the server settings.

It aggregates the per-package configuration owned by the consuming packages (security.Config, observability.Config via ManagementSettings, the server identity type from the domain) together with the infrastructure settings used only by the composition root (database, event, cache).

func (*ServerSettings) String added in v0.1.3

func (s *ServerSettings) String() string

String returns a JSON representation of the ServerSettings struct. It is used for logging and debugging purposes.

Jump to

Keyboard shortcuts

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