Documentation
¶
Overview ¶
Package config provides the configuration for the opampcommander application.
Index ¶
- type AdminSettings
- type AuthSettings
- type DatabaseSettings
- type DatabaseType
- type EventProtocolType
- type EventSettings
- type JWTSettings
- type KafkaSettings
- type LogFormat
- type LogSettings
- type ManagementSettings
- type MetricSettings
- type MetricSettingsForPrometheus
- type MetricType
- type MetricsSettingsForOpenTelemetry
- type OAuthSettings
- type ObservabilitySettings
- type ServerID
- type ServerSettings
- type TraceCompressionAlgorithm
- type TraceProtocol
- type TraceSampler
- type TraceSettings
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
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" )
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 JWTSettings ¶
type JWTSettings struct {
SigningKey string
Issuer string
Expiration time.Duration
Audience []string
}
JWTSettings holds the configuration settings for JSON Web Tokens (JWT).
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 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 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
// ObservabilitySettings holds the settings for observability features.
ObservabilitySettings ObservabilitySettings
}
ManagementSettings holds the settings for the management server.
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
// MetricsSettingsForPrometheus holds the settings specific to Prometheus metrics.
MetricSettingsForPrometheus MetricSettingsForPrometheus
// MetricsSettingsForOpenTelemetry holds the settings specific to OpenTelemetry metrics.
MetricSettingsForOpenTelemetry MetricsSettingsForOpenTelemetry
}
MetricSettings holds the settings for metrics collection.
type MetricSettingsForPrometheus ¶ added in v0.1.22
type MetricSettingsForPrometheus struct {
// Path specifies the path for metrics exposure.
// This is the endpoint to expose metrics.
// It should start with a '/' character.
Path string
}
MetricSettingsForPrometheus holds the settings for Prometheus metrics.
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 MetricsSettingsForOpenTelemetry ¶ added in v0.1.22
type MetricsSettingsForOpenTelemetry struct {
// Endpoint specifies the endpoint for metrics collection.
// This is the endpoint to send metrics to.
// It should be a valid URL or URI.
Endpoint string
}
MetricsSettingsForOpenTelemetry holds the settings for OpenTelemetry metrics.
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 ServerID ¶ added in v0.1.22
type ServerID string
ServerID is a unique identifier for an API server instance.
type ServerSettings ¶
type ServerSettings struct {
Address string
ServerID ServerID
DatabaseSettings DatabaseSettings
AuthSettings AuthSettings
ManagementSettings ManagementSettings
EventSettings EventSettings
}
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.