Documentation
¶
Index ¶
- Variables
- type AdminConfig
- type Config
- type DatabaseConfig
- type Export
- type LogConfig
- type LogFormat
- type LogLevel
- type Map
- type MetricsConfig
- type Opentelemetry
- type OtlpProtocol
- type Pool
- type ProxyConfig
- type ProxyResponse
- type Queue
- type QueueType
- type RedisConfig
- type TracingConfig
- type WorkerConfig
- type WorkerDeliverer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( VERSION = "dev" COMMIT = "unknown" NODE = uuid.NewV4().String() )
Functions ¶
This section is empty.
Types ¶
type AdminConfig ¶
type AdminConfig struct {
Listen string `yaml:"listen"`
}
func (AdminConfig) IsEnabled ¶
func (cfg AdminConfig) IsEnabled() bool
func (AdminConfig) Validate ¶
func (cfg AdminConfig) Validate() error
type Config ¶
type Config struct {
Log LogConfig `yaml:"log" envconfig:"LOG"`
Database DatabaseConfig `yaml:"database" envconfig:"DATABASE"`
Redis RedisConfig `yaml:"redis" envconfig:"REDIS"`
Admin AdminConfig `yaml:"admin" envconfig:"ADMIN"`
Proxy ProxyConfig `yaml:"proxy" envconfig:"PROXY"`
Worker WorkerConfig `yaml:"worker" envconfig:"WORKER"`
Metrics MetricsConfig `yaml:"metrics" envconfig:"METRICS"`
Tracing TracingConfig `yaml:"tracing" envconfig:"TRACING"`
}
func InitWithFile ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `yaml:"host" default:"localhost"`
Port uint32 `yaml:"port" default:"5432"`
Username string `yaml:"username" default:"webhookx"`
Password string `yaml:"password" default:""`
Database string `yaml:"database" default:"webhookx"`
Parameters string `yaml:"parameters" default:"application_name=webhookx&sslmode=disable&connect_timeout=10"`
MaxPoolSize uint32 `yaml:"max_pool_size" default:"40" envconfig:"MAX_POOL_SIZE"`
MaxLifetime uint32 `yaml:"max_life_time" default:"1800" envconfig:"MAX_LIFETIME"`
}
func (DatabaseConfig) GetDSN ¶ added in v0.3.0
func (cfg DatabaseConfig) GetDSN() string
func (*DatabaseConfig) InitSqlDB ¶ added in v0.4.0
func (cfg *DatabaseConfig) InitSqlDB() (*sql.DB, error)
func (DatabaseConfig) Validate ¶
func (cfg DatabaseConfig) Validate() error
type Export ¶ added in v0.3.0
type Export string
const (
ExportOpenTelemetry Export = "opentelemetry"
)
type LogConfig ¶
type MetricsConfig ¶ added in v0.3.0
type MetricsConfig struct {
Attributes Map `yaml:"attributes" envconfig:"ATTRIBUTES"`
Exports []Export `yaml:"exports" envconfig:"EXPORTS"`
PushInterval uint32 `yaml:"push_interval" default:"10"`
Opentelemetry Opentelemetry `yaml:"opentelemetry"`
}
func (*MetricsConfig) Validate ¶ added in v0.3.0
func (cfg *MetricsConfig) Validate() error
type Opentelemetry ¶ added in v0.3.0
type Opentelemetry struct {
Protocol OtlpProtocol `yaml:"protocol" envconfig:"PROTOCOL" default:"http/protobuf"`
Endpoint string `yaml:"endpoint" envconfig:"ENDPOINT" default:"http://localhost:4318/v1/metrics"`
// Deprecated: used by MetricsConfig
PushInterval uint32 `yaml:"push_interval" default:"10"`
}
func (Opentelemetry) Validate ¶ added in v0.3.0
func (cfg Opentelemetry) Validate() error
type OtlpProtocol ¶ added in v0.3.0
type OtlpProtocol string
const ( OtlpProtocolGRPC OtlpProtocol = "grpc" OtlpProtocolHTTP OtlpProtocol = "http/protobuf" )
type ProxyConfig ¶
type ProxyConfig struct {
Listen string `yaml:"listen"`
TimeoutRead int64 `yaml:"timeout_read" default:"10"`
TimeoutWrite int64 `yaml:"timeout_write" default:"10"`
MaxRequestBodySize int64 `yaml:"max_request_body_size" default:"1048576"`
Response ProxyResponse `yaml:"response"`
Queue Queue `yaml:"queue"`
}
func (ProxyConfig) IsEnabled ¶
func (cfg ProxyConfig) IsEnabled() bool
func (ProxyConfig) Validate ¶
func (cfg ProxyConfig) Validate() error
type ProxyResponse ¶
type Queue ¶
type Queue struct {
Type QueueType `yaml:"type" default:"redis"`
Redis RedisConfig `yaml:"redis"`
}
type RedisConfig ¶
type RedisConfig struct {
Host string `yaml:"host" default:"localhost"`
Port uint32 `yaml:"port" default:"6379"`
Password string `yaml:"password" default:""`
Database uint32 `yaml:"database" default:"0"`
}
func (RedisConfig) GetClient ¶
func (cfg RedisConfig) GetClient() *redis.Client
func (RedisConfig) Validate ¶
func (cfg RedisConfig) Validate() error
type TracingConfig ¶ added in v0.4.0
type TracingConfig struct {
Enabled bool `yaml:"enabled" default:"false"`
Attributes Map `yaml:"attributes"`
Opentelemetry Opentelemetry `yaml:"opentelemetry"`
SamplingRate float64 `yaml:"sampling_rate" default:"1.0" envconfig:"SAMPLING_RATE"`
}
func (TracingConfig) Validate ¶ added in v0.4.0
func (cfg TracingConfig) Validate() error
type WorkerConfig ¶
type WorkerConfig struct {
Enabled bool `yaml:"enabled" default:"false"`
Deliverer WorkerDeliverer `yaml:"deliverer"`
Pool Pool `yaml:"pool"`
}
func (*WorkerConfig) Validate ¶
func (cfg *WorkerConfig) Validate() error
type WorkerDeliverer ¶
type WorkerDeliverer struct {
Timeout int64 `yaml:"timeout" default:"60000"`
}
Click to show internal directories.
Click to hide internal directories.