config

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLimit = 1000

MaxLimit is the maximum number of results that can be returned by any query endpoint. This matches the OpenAPI spec's maximum for the limit field and is used to cap the total count reported by OpenSearch (whose hits.total.value caps at 10000).

Variables

This section is empty.

Functions

This section is empty.

Types

type AdaptersConfig added in v0.17.0

type AdaptersConfig struct {
	LogsAdapterEnabled bool          `koanf:"logs.adapter.enabled"`
	LogsAdapterURL     string        `koanf:"logs.adapter.url"`
	LogsAdapterTimeout time.Duration `koanf:"logs.adapter.timeout"`

	TracingAdapterEnabled bool          `koanf:"tracing.adapter.enabled"`
	TracingAdapterURL     string        `koanf:"tracing.adapter.url"`
	TracingAdapterTimeout time.Duration `koanf:"tracing.adapter.timeout"`

	MetricsAdapterURL     string        `koanf:"metrics.adapter.url"`
	MetricsAdapterTimeout time.Duration `koanf:"metrics.adapter.timeout"`
}

AdaptersConfig holds adapter configuration

type AlertingConfig added in v0.9.0

type AlertingConfig struct {
	// RCAServiceURL is the base URL for the AI RCA (Root Cause Analysis) service.
	// Used for health checks and triggering RCA analysis.
	RCAServiceURL string `koanf:"rca.service.url"`
	// AIRCAEnabled controls whether AI-powered root cause analysis is enabled.
	AIRCAEnabled bool `koanf:"ai.rca.enabled"`
	// ObservabilityNamespace is the Kubernetes namespace where openchoreo-observability-plane is deployed.
	// Used for creating/listing PrometheusRule CRs for metric-based alerting.
	ObservabilityNamespace string `koanf:"observability.namespace"`
	// AlertStoreBackend controls where fired alert entries are persisted.
	// Supported values: sqlite (default), postgresql.
	AlertStoreBackend string `koanf:"alert.store.backend"`
	// AlertStoreDSN is the SQL connection string for alert entry storage.
	AlertStoreDSN string `koanf:"alert.store.dsn"`
	// AlertSuppressionWindow is the duration within which duplicate alerts
	// for the same alert rule are suppressed. Set to 0 to disable suppression.
	AlertSuppressionWindow time.Duration `koanf:"alert.suppression.window"`
	// FinOpsAgentURL is the base URL for the FinOps agent service.
	// Used for triggering AI cost analysis for budget alerts.
	FinOpsAgentURL string `koanf:"finops.agent.url"`
	// FinOpsAgentEnabled controls whether FinOps agent integration is enabled.
	FinOpsAgentEnabled bool `koanf:"finops.agent.enabled"`
}

AlertingConfig holds configuration related to alerting features

type AuthConfig

type AuthConfig struct {
	JWTSecret    string                   `koanf:"jwt.secret"`
	EnableAuth   bool                     `koanf:"enable.auth"`
	RequiredRole string                   `koanf:"required.role"`
	SubjectTypes []subject.UserTypeConfig `koanf:"subject_types"`
}

AuthConfig holds authentication configuration

type AuthzConfig added in v0.10.0

type AuthzConfig struct {
	ServiceURL            string        `koanf:"service.url"`
	Timeout               time.Duration `koanf:"timeout"`
	TLSInsecureSkipVerify bool          `koanf:"tls.insecure.skip.verify"`
}

AuthzConfig holds authorization configuration

type CORSConfig added in v0.17.0

type CORSConfig struct {
	AllowedOrigins []string `koanf:"allowed.origins"`
}

CORSConfig holds CORS configuration

type Config

type Config struct {
	Server      ServerConfig      `koanf:"server"`
	OpenSearch  OpenSearchConfig  `koanf:"opensearch"`
	Prometheus  PrometheusConfig  `koanf:"prometheus"`
	Auth        AuthConfig        `koanf:"auth"`
	Authz       AuthzConfig       `koanf:"authz"`
	Logging     LoggingConfig     `koanf:"logging"`
	Alerting    AlertingConfig    `koanf:"alerting"`
	Adapters    AdaptersConfig    `koanf:"adapters"`
	UIDResolver UIDResolverConfig `koanf:"uid_resolver"`
	CORS        CORSConfig        `koanf:"cors"`
	LogLevel    string            `koanf:"loglevel"`
}

Config holds all configuration for the logging service

func Load

func Load() (*Config, error)

Load loads configuration from environment variables and defaults

type LoggingConfig

type LoggingConfig struct {
	MaxLogLimit          int `koanf:"max.log.limit"`
	DefaultLogLimit      int `koanf:"default.log.limit"`
	DefaultBuildLogLimit int `koanf:"default.build.log.limit"`
	MaxLogLinesPerFile   int `koanf:"max.log.lines.per.file"`
}

LoggingConfig holds application logging configuration

type OpenSearchConfig

type OpenSearchConfig struct {
	Address       string        `koanf:"address"`
	Username      string        `koanf:"username"`
	Password      string        `koanf:"password"`
	Timeout       time.Duration `koanf:"timeout"`
	MaxRetries    int           `koanf:"max.retries"`
	IndexPrefix   string        `koanf:"index.prefix"`
	IndexPattern  string        `koanf:"index.pattern"`
	LegacyPattern string        `koanf:"legacy.pattern"`
}

OpenSearchConfig holds OpenSearch connection configuration

type PrometheusConfig added in v0.4.0

type PrometheusConfig struct {
	Address string        `koanf:"address"`
	Timeout time.Duration `koanf:"timeout"`
}

PrometheusConfig holds Prometheus connection configuration

type ServerConfig

type ServerConfig struct {
	Port            int           `koanf:"port"`
	InternalPort    int           `koanf:"internal.port"`
	ReadTimeout     time.Duration `koanf:"read.timeout"`
	WriteTimeout    time.Duration `koanf:"write.timeout"`
	ShutdownTimeout time.Duration `koanf:"shutdown.timeout"`
}

ServerConfig holds HTTP server configuration

type UIDResolverConfig added in v0.17.0

type UIDResolverConfig struct {
	// OpenChoreoAPIURL is the base URL for the openchoreo-api service
	OpenChoreoAPIURL string `koanf:"openchoreo.api.url"`
	// OAuthTokenURL is the OAuth2 token endpoint URL for client credentials grant
	OAuthTokenURL string `koanf:"oauth.token.url"`
	// OAuthClientID is the OAuth2 client ID for authentication
	OAuthClientID string `koanf:"oauth.client.id"`
	// OAuthClientSecret is the OAuth2 client secret for authentication
	OAuthClientSecret string `koanf:"oauth.client.secret"`
	// OAuthScope is the optional OAuth2 scope to request in the token request
	OAuthScope string `koanf:"oauth.scope"`
	// TLSInsecureSkipVerify skips TLS certificate verification (for development)
	TLSInsecureSkipVerify bool `koanf:"tls.insecure.skip.verify"`
	// Timeout is the HTTP client timeout for API calls
	Timeout time.Duration `koanf:"timeout"`
	// MaxAuthRetry is the maximum number of additional attempts after a 401
	// response from openchoreo-api when resolving a resource UID.
	MaxAuthRetry int `koanf:"max.auth.retry"`
}

UIDResolverConfig holds configuration for the resource UID resolver which resolves resource names to UIDs via the openchoreo-api

Jump to

Keyboard shortcuts

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