Documentation
¶
Index ¶
- func NormalizeServiceEnvironment(value string) string
- type AuthConfigGetter
- type GRPCConfigGetter
- type HTTPConfigGetter
- type RedpandaConfigGetter
- type ServiceAppConfig
- type ServiceAppConfigGetter
- type ServiceAuthConfig
- func (c ServiceAuthConfig) GetAllowedAudiences() string
- func (c ServiceAuthConfig) GetEnabled() bool
- func (c ServiceAuthConfig) GetIssuer() string
- func (c ServiceAuthConfig) GetJWKSCacheTTL() time.Duration
- func (c ServiceAuthConfig) GetJWKSPath() string
- func (c ServiceAuthConfig) GetServiceURL() string
- func (c ServiceAuthConfig) GetTimeout() time.Duration
- func (c ServiceAuthConfig) JWKSURL() string
- type ServiceConfig
- func (c ServiceConfig) GetAppConfig() ServiceAppConfig
- func (c ServiceConfig) GetAuthConfig() ServiceAuthConfig
- func (c ServiceConfig) GetGRPCConfig() ServiceGRPCConfig
- func (c ServiceConfig) GetHTTPConfig() ServiceHTTPConfig
- func (c ServiceConfig) GetLoggerConfig() ServiceLoggerConfig
- func (c ServiceConfig) GetMetricsConfig() ServiceMetricsConfig
- func (c ServiceConfig) GetPostgresConfig() ServicePostgresConfig
- func (c ServiceConfig) GetRedisConfig() ServiceRedisConfig
- func (c ServiceConfig) GetRedpandaConfig() ServiceRedpandaConfig
- func (c ServiceConfig) GetServiceIdentityConfig() ServiceIdentityConfig
- func (c ServiceConfig) GetTLSConfig() ServiceTLSConfig
- func (c ServiceConfig) GetTelemetryConfig() ServiceTelemetryConfig
- func (c *ServiceConfig) Normalize()
- func (c ServiceConfig) Validate() error
- type ServiceConfigGetter
- type ServiceGRPCConfig
- type ServiceHTTPConfig
- type ServiceIdentityClientConfig
- type ServiceIdentityConfig
- type ServiceIdentityConfigGetter
- type ServiceIdentityVerifierConfig
- type ServiceLoggerConfig
- type ServiceLoggerConfigGetter
- type ServiceLoggerOpenSearchConfig
- type ServiceMetricsConfig
- type ServiceMetricsConfigGetter
- type ServicePostgresConfig
- func (c ServicePostgresConfig) DSN() string
- func (c ServicePostgresConfig) GetConnTimeout() int
- func (c ServicePostgresConfig) GetDatabase() string
- func (c ServicePostgresConfig) GetHost() string
- func (c ServicePostgresConfig) GetMaxConn() int
- func (c ServicePostgresConfig) GetMaxConnIdleTime() time.Duration
- func (c ServicePostgresConfig) GetMigrationsEnabled() bool
- func (c ServicePostgresConfig) GetMinConnLifeTime() time.Duration
- func (c ServicePostgresConfig) GetPassword() string
- func (c ServicePostgresConfig) GetPort() int
- func (c ServicePostgresConfig) GetSSLMode() string
- func (c ServicePostgresConfig) GetSchema() string
- func (c ServicePostgresConfig) GetUser() string
- type ServicePostgresConfigGetter
- type ServiceRedisConfig
- type ServiceRedisConfigGetter
- type ServiceRedpandaConfig
- func (c ServiceRedpandaConfig) BrokerList() []string
- func (c ServiceRedpandaConfig) GetBrokers() string
- func (c ServiceRedpandaConfig) GetClientID() string
- func (c ServiceRedpandaConfig) GetDialTimeout() time.Duration
- func (c ServiceRedpandaConfig) GetEnabled() bool
- func (c ServiceRedpandaConfig) GetReadBatchTimeout() time.Duration
- func (c ServiceRedpandaConfig) GetWriteTimeout() time.Duration
- type ServiceTLSConfig
- type ServiceTLSConfigGetter
- type ServiceTelemetryConfig
- type TelemetryConfigGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthConfigGetter ¶
type GRPCConfigGetter ¶ added in v0.4.0
type GRPCConfigGetter interface {
GetGRPCConfig() ServiceGRPCConfig
}
GRPCConfigGetter is intentionally separate from ServiceConfigGetter so HTTP-only consumers are not forced to implement a new method.
type HTTPConfigGetter ¶
type RedpandaConfigGetter ¶
type ServiceAppConfig ¶
type ServiceAppConfig struct {
Env string `mapstructure:"env"`
Name string `mapstructure:"name"`
Version string `mapstructure:"version"`
PublicURL string `mapstructure:"public_url"`
}
func (ServiceAppConfig) GetEnv ¶
func (c ServiceAppConfig) GetEnv() string
func (ServiceAppConfig) GetName ¶
func (c ServiceAppConfig) GetName() string
func (ServiceAppConfig) GetPublicURL ¶
func (c ServiceAppConfig) GetPublicURL() string
func (ServiceAppConfig) GetVersion ¶
func (c ServiceAppConfig) GetVersion() string
func (ServiceAppConfig) IsProduction ¶
func (c ServiceAppConfig) IsProduction() bool
type ServiceAppConfigGetter ¶
type ServiceAuthConfig ¶
type ServiceAuthConfig struct {
Enabled bool `mapstructure:"enabled"`
ServiceURL string `mapstructure:"service_url"`
Issuer string `mapstructure:"issuer"`
AllowedAudiences string `mapstructure:"allowed_audiences"`
JWKSPath string `mapstructure:"jwks_path"`
JWKSCacheTTL time.Duration `mapstructure:"jwks_cache_ttl"`
Timeout time.Duration `mapstructure:"timeout"`
}
func (ServiceAuthConfig) GetAllowedAudiences ¶
func (c ServiceAuthConfig) GetAllowedAudiences() string
func (ServiceAuthConfig) GetEnabled ¶
func (c ServiceAuthConfig) GetEnabled() bool
func (ServiceAuthConfig) GetIssuer ¶
func (c ServiceAuthConfig) GetIssuer() string
func (ServiceAuthConfig) GetJWKSCacheTTL ¶
func (c ServiceAuthConfig) GetJWKSCacheTTL() time.Duration
func (ServiceAuthConfig) GetJWKSPath ¶
func (c ServiceAuthConfig) GetJWKSPath() string
func (ServiceAuthConfig) GetServiceURL ¶
func (c ServiceAuthConfig) GetServiceURL() string
func (ServiceAuthConfig) GetTimeout ¶
func (c ServiceAuthConfig) GetTimeout() time.Duration
func (ServiceAuthConfig) JWKSURL ¶
func (c ServiceAuthConfig) JWKSURL() string
type ServiceConfig ¶
type ServiceConfig struct {
App ServiceAppConfig `mapstructure:"app"`
HTTP ServiceHTTPConfig `mapstructure:"http"`
GRPC ServiceGRPCConfig `mapstructure:"grpc"`
Logger ServiceLoggerConfig `mapstructure:"logger"`
Metrics ServiceMetricsConfig `mapstructure:"metrics"`
Redis ServiceRedisConfig `mapstructure:"redis"`
Postgres ServicePostgresConfig `mapstructure:"postgres"`
Auth ServiceAuthConfig `mapstructure:"auth"`
Telemetry ServiceTelemetryConfig `mapstructure:"telemetry"`
Redpanda ServiceRedpandaConfig `mapstructure:"redpanda"`
TLS ServiceTLSConfig `mapstructure:"tls"`
Identity ServiceIdentityConfig `mapstructure:"service_identity"`
}
func Load ¶
func Load() (*ServiceConfig, error)
Load is the package-level entrypoint for the current service configuration.
func LoadServiceConfig ¶
func LoadServiceConfig() (*ServiceConfig, error)
func (ServiceConfig) GetAppConfig ¶
func (c ServiceConfig) GetAppConfig() ServiceAppConfig
func (ServiceConfig) GetAuthConfig ¶
func (c ServiceConfig) GetAuthConfig() ServiceAuthConfig
func (ServiceConfig) GetGRPCConfig ¶ added in v0.4.0
func (c ServiceConfig) GetGRPCConfig() ServiceGRPCConfig
func (ServiceConfig) GetHTTPConfig ¶
func (c ServiceConfig) GetHTTPConfig() ServiceHTTPConfig
func (ServiceConfig) GetLoggerConfig ¶
func (c ServiceConfig) GetLoggerConfig() ServiceLoggerConfig
func (ServiceConfig) GetMetricsConfig ¶
func (c ServiceConfig) GetMetricsConfig() ServiceMetricsConfig
func (ServiceConfig) GetPostgresConfig ¶
func (c ServiceConfig) GetPostgresConfig() ServicePostgresConfig
func (ServiceConfig) GetRedisConfig ¶
func (c ServiceConfig) GetRedisConfig() ServiceRedisConfig
func (ServiceConfig) GetRedpandaConfig ¶
func (c ServiceConfig) GetRedpandaConfig() ServiceRedpandaConfig
func (ServiceConfig) GetServiceIdentityConfig ¶ added in v0.4.0
func (c ServiceConfig) GetServiceIdentityConfig() ServiceIdentityConfig
func (ServiceConfig) GetTLSConfig ¶
func (c ServiceConfig) GetTLSConfig() ServiceTLSConfig
func (ServiceConfig) GetTelemetryConfig ¶
func (c ServiceConfig) GetTelemetryConfig() ServiceTelemetryConfig
func (*ServiceConfig) Normalize ¶
func (c *ServiceConfig) Normalize()
func (ServiceConfig) Validate ¶
func (c ServiceConfig) Validate() error
type ServiceConfigGetter ¶
type ServiceConfigGetter interface {
GetAppConfig() ServiceAppConfig
GetHTTPConfig() ServiceHTTPConfig
GetLoggerConfig() ServiceLoggerConfig
GetMetricsConfig() ServiceMetricsConfig
GetRedisConfig() ServiceRedisConfig
GetPostgresConfig() ServicePostgresConfig
GetAuthConfig() ServiceAuthConfig
GetTelemetryConfig() ServiceTelemetryConfig
GetRedpandaConfig() ServiceRedpandaConfig
GetTLSConfig() ServiceTLSConfig
}
type ServiceGRPCConfig ¶ added in v0.4.0
type ServiceGRPCConfig struct {
Enabled bool `mapstructure:"enabled"`
Port int `mapstructure:"port"`
MaxReceiveBytes int `mapstructure:"max_receive_bytes"`
MaxSendBytes int `mapstructure:"max_send_bytes"`
GracefulStopTimeout time.Duration `mapstructure:"graceful_stop_timeout"`
KeepaliveTime time.Duration `mapstructure:"keepalive_time"`
KeepaliveTimeout time.Duration `mapstructure:"keepalive_timeout"`
}
ServiceGRPCConfig describes the optional gRPC listener owned by a service.
type ServiceHTTPConfig ¶
type ServiceHTTPConfig struct {
Port string `mapstructure:"port"`
CORSAllowedOrigins string `mapstructure:"cors_allowed_origins"`
}
func (ServiceHTTPConfig) BindAddr ¶
func (c ServiceHTTPConfig) BindAddr() string
func (ServiceHTTPConfig) GetCORSAllowedOrigins ¶
func (c ServiceHTTPConfig) GetCORSAllowedOrigins() string
func (ServiceHTTPConfig) GetPort ¶
func (c ServiceHTTPConfig) GetPort() string
type ServiceIdentityClientConfig ¶ added in v0.4.0
type ServiceIdentityClientConfig struct {
Enabled bool `mapstructure:"enabled"`
TokenURL string `mapstructure:"token_url"`
ClientID string `mapstructure:"client_id"`
ClientSecret string `mapstructure:"client_secret"`
Audience string `mapstructure:"audience"`
Scope string `mapstructure:"scope"`
Timeout time.Duration `mapstructure:"timeout"`
}
type ServiceIdentityConfig ¶ added in v0.4.0
type ServiceIdentityConfig struct {
Verifier ServiceIdentityVerifierConfig `mapstructure:"verifier"`
Client ServiceIdentityClientConfig `mapstructure:"client"`
}
ServiceIdentityConfig contains independent inbound verifier and outbound client-credentials settings. A service may enable either side or both.
type ServiceIdentityConfigGetter ¶ added in v0.4.0
type ServiceIdentityConfigGetter interface {
GetServiceIdentityConfig() ServiceIdentityConfig
}
type ServiceIdentityVerifierConfig ¶ added in v0.4.0
type ServiceIdentityVerifierConfig struct {
Enabled bool `mapstructure:"enabled"`
Issuer string `mapstructure:"issuer"`
JWKSURL string `mapstructure:"jwks_url"`
Audience string `mapstructure:"audience"`
AllowedCallers string `mapstructure:"allowed_callers"`
AllowedAlgorithms string `mapstructure:"allowed_algorithms"`
JWKSCacheTTL time.Duration `mapstructure:"jwks_cache_ttl"`
Timeout time.Duration `mapstructure:"timeout"`
}
func (ServiceIdentityVerifierConfig) AlgorithmList ¶ added in v0.4.0
func (c ServiceIdentityVerifierConfig) AlgorithmList() []string
func (ServiceIdentityVerifierConfig) CallerList ¶ added in v0.4.0
func (c ServiceIdentityVerifierConfig) CallerList() []string
type ServiceLoggerConfig ¶
type ServiceLoggerConfig struct {
Level string `mapstructure:"level"`
OpenSearch ServiceLoggerOpenSearchConfig `mapstructure:"opensearch"`
}
func (ServiceLoggerConfig) GetLoggerConfig ¶
func (c ServiceLoggerConfig) GetLoggerConfig() string
type ServiceLoggerConfigGetter ¶
type ServiceLoggerConfigGetter interface {
GetLoggerConfig() string
}
type ServiceLoggerOpenSearchConfig ¶ added in v0.3.0
type ServiceLoggerOpenSearchConfig struct {
Enabled bool `mapstructure:"enabled"`
Endpoint string `mapstructure:"endpoint"`
Index string `mapstructure:"index"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
FlushInterval time.Duration `mapstructure:"flush_interval"`
BatchSize int `mapstructure:"batch_size"`
QueueSize int `mapstructure:"queue_size"`
RequestTimeout time.Duration `mapstructure:"request_timeout"`
}
ServiceLoggerOpenSearchConfig задает прямую выгрузку структурированных логов в OpenSearch Bulk API. Пустой endpoint отключает exporter.
type ServiceMetricsConfig ¶
type ServiceMetricsConfig struct {
Enabled bool `mapstructure:"enabled"`
BindAddress string `mapstructure:"bind_address"`
HandlerPath string `mapstructure:"handler_path"`
}
func (ServiceMetricsConfig) GetBindAddress ¶
func (c ServiceMetricsConfig) GetBindAddress() string
func (ServiceMetricsConfig) GetEnabled ¶
func (c ServiceMetricsConfig) GetEnabled() bool
func (ServiceMetricsConfig) GetHandlerPath ¶
func (c ServiceMetricsConfig) GetHandlerPath() string
type ServicePostgresConfig ¶
type ServicePostgresConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
Database string `mapstructure:"database"`
Schema string `mapstructure:"schema"`
SSLMode string `mapstructure:"sslmode"`
ConnTimeout int `mapstructure:"conn_timeout"`
MaxConn int `mapstructure:"max_conn"`
MaxConnLifetime time.Duration `mapstructure:"max_conn_lifetime"`
MaxConnIdleTime time.Duration `mapstructure:"max_conn_idle_time"`
MigrationsEnabled bool `mapstructure:"migrations_enabled"`
}
func (ServicePostgresConfig) DSN ¶
func (c ServicePostgresConfig) DSN() string
func (ServicePostgresConfig) GetConnTimeout ¶
func (c ServicePostgresConfig) GetConnTimeout() int
func (ServicePostgresConfig) GetDatabase ¶
func (c ServicePostgresConfig) GetDatabase() string
func (ServicePostgresConfig) GetHost ¶
func (c ServicePostgresConfig) GetHost() string
func (ServicePostgresConfig) GetMaxConn ¶
func (c ServicePostgresConfig) GetMaxConn() int
func (ServicePostgresConfig) GetMaxConnIdleTime ¶
func (c ServicePostgresConfig) GetMaxConnIdleTime() time.Duration
func (ServicePostgresConfig) GetMigrationsEnabled ¶
func (c ServicePostgresConfig) GetMigrationsEnabled() bool
func (ServicePostgresConfig) GetMinConnLifeTime ¶
func (c ServicePostgresConfig) GetMinConnLifeTime() time.Duration
func (ServicePostgresConfig) GetPassword ¶
func (c ServicePostgresConfig) GetPassword() string
func (ServicePostgresConfig) GetPort ¶
func (c ServicePostgresConfig) GetPort() int
func (ServicePostgresConfig) GetSSLMode ¶
func (c ServicePostgresConfig) GetSSLMode() string
func (ServicePostgresConfig) GetSchema ¶
func (c ServicePostgresConfig) GetSchema() string
func (ServicePostgresConfig) GetUser ¶
func (c ServicePostgresConfig) GetUser() string
type ServicePostgresConfigGetter ¶
type ServicePostgresConfigGetter interface {
GetUser() string
GetPassword() string
GetDatabase() string
GetHost() string
GetPort() int
GetSSLMode() string
GetConnTimeout() int
GetMaxConn() int
GetMinConnLifeTime() time.Duration
GetMaxConnIdleTime() time.Duration
GetSchema() string
GetMigrationsEnabled() bool
DSN() string
}
type ServiceRedisConfig ¶
type ServiceRedisConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Database int `mapstructure:"database"`
}
func (ServiceRedisConfig) Addr ¶
func (c ServiceRedisConfig) Addr() string
func (ServiceRedisConfig) GetDatabase ¶
func (c ServiceRedisConfig) GetDatabase() int
func (ServiceRedisConfig) GetHost ¶
func (c ServiceRedisConfig) GetHost() string
func (ServiceRedisConfig) GetPassword ¶
func (c ServiceRedisConfig) GetPassword() string
func (ServiceRedisConfig) GetPort ¶
func (c ServiceRedisConfig) GetPort() int
func (ServiceRedisConfig) GetUsername ¶
func (c ServiceRedisConfig) GetUsername() string
type ServiceRedpandaConfig ¶
type ServiceRedpandaConfig struct {
Enabled bool `mapstructure:"enabled"`
Brokers string `mapstructure:"brokers"`
ClientID string `mapstructure:"client_id"`
DialTimeout time.Duration `mapstructure:"dial_timeout"`
ReadBatchTimeout time.Duration `mapstructure:"read_batch_timeout"`
WriteTimeout time.Duration `mapstructure:"write_timeout"`
}
func (ServiceRedpandaConfig) BrokerList ¶
func (c ServiceRedpandaConfig) BrokerList() []string
func (ServiceRedpandaConfig) GetBrokers ¶
func (c ServiceRedpandaConfig) GetBrokers() string
func (ServiceRedpandaConfig) GetClientID ¶
func (c ServiceRedpandaConfig) GetClientID() string
func (ServiceRedpandaConfig) GetDialTimeout ¶
func (c ServiceRedpandaConfig) GetDialTimeout() time.Duration
func (ServiceRedpandaConfig) GetEnabled ¶
func (c ServiceRedpandaConfig) GetEnabled() bool
func (ServiceRedpandaConfig) GetReadBatchTimeout ¶
func (c ServiceRedpandaConfig) GetReadBatchTimeout() time.Duration
func (ServiceRedpandaConfig) GetWriteTimeout ¶
func (c ServiceRedpandaConfig) GetWriteTimeout() time.Duration
type ServiceTLSConfig ¶
type ServiceTLSConfig struct {
Enabled bool `mapstructure:"enabled"`
CertFile string `mapstructure:"cert_file"`
KeyFile string `mapstructure:"key_file"`
CAFile string `mapstructure:"ca_file"`
InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
}
func (ServiceTLSConfig) GetCaFile ¶
func (c ServiceTLSConfig) GetCaFile() string
func (ServiceTLSConfig) GetCertFile ¶
func (c ServiceTLSConfig) GetCertFile() string
func (ServiceTLSConfig) GetEnabled ¶
func (c ServiceTLSConfig) GetEnabled() bool
func (ServiceTLSConfig) GetInsecureSkipVerify ¶
func (c ServiceTLSConfig) GetInsecureSkipVerify() bool
func (ServiceTLSConfig) GetKeyFile ¶
func (c ServiceTLSConfig) GetKeyFile() string
type ServiceTLSConfigGetter ¶
type ServiceTLSConfigGetter interface {
GetEnabled() bool
GetCertFile() string
GetKeyFile() string
GetCaFile() string
GetInsecureSkipVerify() bool
}
ServiceTLSConfig is shared by server and client modules. When Enabled is true and the config is used for server TLS, CertFile and KeyFile are required.
type ServiceTelemetryConfig ¶
type ServiceTelemetryConfig struct {
Enabled bool `mapstructure:"enabled"`
OTLPEndpoint string `mapstructure:"otlp_endpoint"`
OTLPInsecure bool `mapstructure:"otlp_insecure"`
}
func (ServiceTelemetryConfig) GetEnabled ¶
func (c ServiceTelemetryConfig) GetEnabled() bool
func (ServiceTelemetryConfig) GetOTLPEndpoint ¶
func (c ServiceTelemetryConfig) GetOTLPEndpoint() string
func (ServiceTelemetryConfig) GetOTLPInsecure ¶
func (c ServiceTelemetryConfig) GetOTLPInsecure() bool