config

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 3 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 AdminSettings

type AdminSettings struct {
	// Username is the username for the admin user.
	Username string
	// Password is the password for the admin user.
	Password string
	// Email is the email address for the admin user.
	// This is used in jwt claims.
	Email string
}

AdminSettings holds the configuration settings for admin authentication. This is used for basic authentication of the admin user.

type AuthSettings

type AuthSettings struct {
	// JWTSettings holds the configuration settings for JSON Web Tokens (JWT).
	JWTSettings JWTSettings
	// AdminSettings holds the configuration settings for admin authentication.
	AdminSettings AdminSettings
	// OAuthSettings holds the configuration settings for OAuth2 authentication.
	OAuthSettings *OAuthSettings
}

AuthSettings holds the authentication settings for the application.

type DatabaseSettings added in v0.1.6

type DatabaseSettings struct {
	Type      DatabaseType
	Endpoints []string
}

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 (
	// DatabaseTypeEtcd represents an etcd database.
	DatabaseTypeEtcd DatabaseType = "etcd"
)

type JWTSettings

type JWTSettings struct {
	SigningKey string
	Issuer     string
	Expiration time.Duration
	Audience   []string
}

JWTSettings holds the configuration settings for JSON Web Tokens (JWT).

type LogFormat

type LogFormat string

LogFormat is a string type that represents the log format.

const (
	// LogFormatText represents the text log format.
	LogFormatText LogFormat = "text"
	// LogFormatJSON represents the JSON log format.
	LogFormatJSON LogFormat = "json"
)

type LogSettings added in v0.1.6

type LogSettings struct {
	// Enabled indicates whether logging is enabled.
	Enabled bool
	// Level specifies the log level.
	Level slog.Level
	// Format specifies the log format (e.g., text or json).
	Format LogFormat
}

LogSettings holds the settings for logging. It only supports stdout/stderr logging for now.

type MetricSettings added in v0.1.6

type MetricSettings struct {
	// Enabled indicates whether metrics collection is enabled.
	Enabled bool

	// Type specifies the type of metrics to be used.
	Type MetricType

	// Endpoint specifies the endpoint for metrics collection.
	// When using Prometheus, this is the endpoint to expose metrics.
	// When using OpenTelemetry, this is the endpoint to send metrics to.
	// It should be a valid URL or URI.
	Endpoint string
}

MetricSettings holds the settings for metrics collection.

type MetricType added in v0.1.6

type MetricType string

MetricType represents the type of metrics to be used.

const (
	// MetricTypePrometheus represents Prometheus metrics.
	MetricTypePrometheus MetricType = "prometheus"
	// MetricTypeOTel represents OpenTelemetry metrics.
	MetricTypeOTel MetricType = "otel"
)

type OAuthSettings

type OAuthSettings struct {
	// ClientID is the OAuth2 client ID for GitHub authentication.
	ClientID string
	// Secret is the OAuth2 client secret for GitHub authentication.
	Secret string
	// CallbackURL is the URL to which GitHub will redirect after authentication.
	CallbackURL string
	// JWTSettings holds the JWT configuration settings.
	// This is used for the state parameter in OAuth2 authentication.
	JWTSettings JWTSettings
}

OAuthSettings holds the configuration settings for GitHub OAuth2 authentication.

type ObservabilitySettings added in v0.1.6

type ObservabilitySettings struct {
	// ServiceName is the name of the service for which observability is configured.
	// It used for naming traces, metrics, and logs.
	ServiceName string

	Metric MetricSettings
	Log    LogSettings
	Trace  TraceSettings
}

ObservabilitySettings holds the settings for observability features.

type ServerSettings

type ServerSettings struct {
	Address               string
	DatabaseSettings      DatabaseSettings
	AuthSettings          AuthSettings
	ObservabilitySettings ObservabilitySettings
}

ServerSettings is a struct that holds the server settings.

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.

type TraceCompressionAlgorithm added in v0.1.20

type TraceCompressionAlgorithm string

TraceCompressionAlgorithm represents the compression algorithm used for tracing.

const (
	// TraceCompressionAlgorithmGzip represents the gzip compression algorithm.
	TraceCompressionAlgorithmGzip TraceCompressionAlgorithm = "gzip"
)

type TraceProtocol added in v0.1.20

type TraceProtocol string

TraceProtocol represents the protocol used for tracing.

const (
	// TraceProtocolHTTP represents the HTTP protocol for tracing.
	TraceProtocolHTTP TraceProtocol = "http"
	// TraceProtocolGRPC represents the gRPC protocol for tracing.
	TraceProtocolGRPC TraceProtocol = "grpc"
)

type TraceSampler added in v0.1.20

type TraceSampler string

TraceSampler represents the sampling strategy for tracing.

const (
	// TraceSamplerAlways samples all traces.
	TraceSamplerAlways TraceSampler = "always"
	// TraceSamplerNever samples no traces.
	TraceSamplerNever TraceSampler = "never"
	// TraceSamplerProbability samples a percentage of traces based on probability.
	TraceSamplerProbability TraceSampler = "probability"
)

type TraceSettings added in v0.1.6

type TraceSettings struct {
	// Enabled indicates whether tracing is enabled.
	Enabled bool
	// Protocol specifies the protocol for tracing.
	Protocol TraceProtocol
	// Compression specifies the compression type for tracing.
	Compression bool
	// CompressionAlgorithm specifies the compression algorithm for tracing.
	CompressionAlgorithm TraceCompressionAlgorithm
	// Insecure indicates whether to use insecure connection for tracing.
	Insecure bool
	// Headers specifies the headers to be sent with tracing requests.
	Headers map[string]string
	// Endpoint specifies the endpoint for tracing.
	Endpoint string
	// Sampler specifies the sampling strategy for tracing.
	// Possible values are defined in the TraceSampler type (e.g., always, never, probability).
	Sampler TraceSampler
	// SamplerRatio is used when the Sampler is set to TraceSamplerProbability.
	// It should be a value between 0.0 and 1.0.
	SamplerRatio float64
}

TraceSettings holds the settings for tracing.

Jump to

Keyboard shortcuts

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