config

package
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyConfig

type APIKeyConfig struct {
	Header string                   `mapstructure:"header" validate:"required" default:"x-api-key"`
	Keys   map[string]APIKeyDetails `mapstructure:"keys"` // map of hashed API key to its details
}

type APIKeyDetails

type APIKeyDetails struct {
	TenantID string `mapstructure:"tenant_id" json:"tenant_id" validate:"required"`
	UserID   string `mapstructure:"user_id" json:"user_id" validate:"required"`
	Name     string `mapstructure:"name" json:"name" validate:"required"`      // description of what this key is for
	IsActive bool   `mapstructure:"is_active" json:"is_active" default:"true"` // whether this key is active
}

type AuthConfig

type AuthConfig struct {
	Provider types.AuthProvider `mapstructure:"provider" validate:"required"`
	Secret   string             `mapstructure:"secret" validate:"required"`
	Supabase SupabaseConfig     `mapstructure:"supabase"`
	APIKey   APIKeyConfig       `mapstructure:"api_key"`
}

type BillingConfig added in v1.0.0

type BillingConfig struct {
	TenantID      string `mapstructure:"tenant_id" validate:"omitempty"`
	EnvironmentID string `mapstructure:"environment_id" validate:"omitempty"`
}

type BucketConfig added in v1.0.13

type BucketConfig struct {
	Bucket                string `mapstructure:"bucket" validate:"required"`
	PresignExpiryDuration string `mapstructure:"presign_expiry_duration" validate:"required"`
	KeyPrefix             string `mapstructure:"key_prefix" validate:"omitempty"`
}

type CacheConfig added in v1.0.17

type CacheConfig struct {
	Enabled bool `mapstructure:"enabled" validate:"required"`
}

type ClickHouseConfig

type ClickHouseConfig struct {
	Address  string `mapstructure:"address" validate:"required"`
	TLS      bool   `mapstructure:"tls"`
	Username string `mapstructure:"username" validate:"required"`
	Password string `mapstructure:"password" validate:"required"`
	Database string `mapstructure:"database" validate:"required"`
}

func (ClickHouseConfig) GetClientOptions

func (c ClickHouseConfig) GetClientOptions() *clickhouse.Options

type Configuration

type Configuration struct {
	Deployment           DeploymentConfig           `validate:"required"`
	Server               ServerConfig               `validate:"required"`
	Auth                 AuthConfig                 `validate:"required"`
	Kafka                KafkaConfig                `validate:"required"`
	ClickHouse           ClickHouseConfig           `validate:"required"`
	Logging              LoggingConfig              `validate:"required"`
	Postgres             PostgresConfig             `validate:"required"`
	Sentry               SentryConfig               `validate:"required"`
	Pyroscope            PyroscopeConfig            `validate:"required"`
	Event                EventConfig                `validate:"required"`
	DynamoDB             DynamoDBConfig             `validate:"required"`
	Temporal             TemporalConfig             `validate:"required"`
	Webhook              Webhook                    `validate:"omitempty"`
	Secrets              SecretsConfig              `validate:"required"`
	Billing              BillingConfig              `validate:"omitempty"`
	S3                   S3Config                   `validate:"required"`
	Cache                CacheConfig                `validate:"required"`
	EventPostProcessing  EventPostProcessingConfig  `mapstructure:"event_post_processing" validate:"required"`
	FeatureUsageTracking FeatureUsageTrackingConfig `mapstructure:"feature_usage_tracking" validate:"required"`
	EnvAccess            EnvAccessConfig            `mapstructure:"env_access" json:"env_access" validate:"omitempty"`
	FeatureFlag          FeatureFlagConfig          `mapstructure:"feature_flag" validate:"required"`
}

func GetDefaultConfig

func GetDefaultConfig() *Configuration

GetDefaultConfig returns a default configuration for local development This is useful for running scripts or other non-web applications

func NewConfig

func NewConfig() (*Configuration, error)

func (Configuration) Validate

func (c Configuration) Validate() error

type DeploymentConfig

type DeploymentConfig struct {
	Mode types.RunMode `mapstructure:"mode" validate:"required"`
}

type DynamoDBConfig

type DynamoDBConfig struct {
	InUse          bool   `mapstructure:"in_use" validate:"required" default:"false"`
	Region         string `mapstructure:"region"`
	EventTableName string `mapstructure:"event_table_name"`
}

DynamoDBConfig holds configuration for DynamoDB

type EnvAccessConfig added in v1.0.18

type EnvAccessConfig struct {
	UserEnvMapping map[string]map[string][]string `mapstructure:"user_env_mapping" json:"user_env_mapping" validate:"omitempty"`
}

type EventConfig

type EventConfig struct {
	PublishDestination types.PublishDestination `mapstructure:"publish_destination" default:"kafka"`
}

EventConfig holds configuration for event processing

type EventPostProcessingConfig added in v1.0.17

type EventPostProcessingConfig struct {
	// Rate limit in messages consumed per second
	Topic                 string `mapstructure:"topic" default:"events_post_processing"`
	RateLimit             int64  `mapstructure:"rate_limit" default:"1"`
	ConsumerGroup         string `mapstructure:"consumer_group" default:"v1_events_post_processing"`
	TopicBackfill         string `mapstructure:"topic_backfill" default:"v1_events_post_processing_backfill"`
	RateLimitBackfill     int64  `mapstructure:"rate_limit_backfill" default:"1"`
	ConsumerGroupBackfill string `mapstructure:"consumer_group_backfill" default:"v1_events_post_processing_backfill"`
}

type FeatureFlagConfig added in v1.0.29

type FeatureFlagConfig struct {
	EnableFeatureUsageForAnalytics bool `mapstructure:"enable_feature_usage_for_analytics" validate:"required"`
}

type FeatureUsageTrackingConfig added in v1.0.27

type FeatureUsageTrackingConfig struct {
	// Rate limit in messages consumed per second
	Topic                 string `mapstructure:"topic" default:"events"`
	RateLimit             int64  `mapstructure:"rate_limit" default:"1"`
	ConsumerGroup         string `mapstructure:"consumer_group" default:"v1_feature_tracking_service"`
	TopicBackfill         string `mapstructure:"topic_backfill" default:"v1_feature_tracking_service_backfill"`
	RateLimitBackfill     int64  `mapstructure:"rate_limit_backfill" default:"1"`
	ConsumerGroupBackfill string `mapstructure:"consumer_group_backfill" default:"v1_feature_tracking_service_backfill"`
}

type KafkaConfig

type KafkaConfig struct {
	Brokers       []string             `mapstructure:"brokers" validate:"required"`
	ConsumerGroup string               `mapstructure:"consumer_group" validate:"required"`
	Topic         string               `mapstructure:"topic" validate:"required"`
	TLS           bool                 `mapstructure:"tls"` // set to true if using 9094 port else can set to false
	UseSASL       bool                 `mapstructure:"use_sasl"`
	SASLMechanism sarama.SASLMechanism `mapstructure:"sasl_mechanism"`
	SASLUser      string               `mapstructure:"sasl_user"`
	SASLPassword  string               `mapstructure:"sasl_password"`
	ClientID      string               `mapstructure:"client_id" validate:"required"`
}

type LoggingConfig

type LoggingConfig struct {
	Level types.LogLevel `mapstructure:"level" validate:"required"`
}

type PostgresConfig

type PostgresConfig struct {
	Host                   string `mapstructure:"host" validate:"required"`
	Port                   int    `mapstructure:"port" validate:"required"`
	User                   string `mapstructure:"user" validate:"required"`
	Password               string `mapstructure:"password" validate:"required"`
	DBName                 string `mapstructure:"dbname" validate:"required"`
	SSLMode                string `mapstructure:"sslmode" validate:"required"`
	MaxOpenConns           int    `mapstructure:"max_open_conns" default:"10"`
	MaxIdleConns           int    `mapstructure:"max_idle_conns" default:"5"`
	ConnMaxLifetimeMinutes int    `mapstructure:"conn_max_lifetime_minutes" default:"60"`
	AutoMigrate            bool   `mapstructure:"auto_migrate" default:"false"`
}

func (PostgresConfig) GetDSN

func (c PostgresConfig) GetDSN() string

type PyroscopeConfig added in v1.0.21

type PyroscopeConfig struct {
	Enabled         bool     `mapstructure:"enabled"`
	ServerAddress   string   `mapstructure:"server_address"`
	ApplicationName string   `mapstructure:"application_name"`
	BasicAuthUser   string   `mapstructure:"basic_auth_user"`
	BasicAuthPass   string   `mapstructure:"basic_auth_password"`
	ProfileTypes    []string `mapstructure:"profile_types"`
	SampleRate      uint32   `mapstructure:"sample_rate" default:"100"`
	DisableGCRuns   bool     `mapstructure:"disable_gc_runs" default:"false"`
}

type S3Config added in v1.0.13

type S3Config struct {
	Enabled             bool         `mapstructure:"enabled" validate:"required"`
	Region              string       `mapstructure:"region" validate:"required"`
	InvoiceBucketConfig BucketConfig `mapstructure:"invoice" validate:"required"`
}

type SecretsConfig

type SecretsConfig struct {
	EncryptionKey string `mapstructure:"encryption_key" validate:"required"`
}

type SentryConfig

type SentryConfig struct {
	Enabled     bool    `mapstructure:"enabled"`
	DSN         string  `mapstructure:"dsn"`
	Environment string  `mapstructure:"environment"`
	SampleRate  float64 `mapstructure:"sample_rate" default:"1.0"`
}

type ServerConfig

type ServerConfig struct {
	Address string `mapstructure:"address" validate:"required"`
}

type SupabaseConfig

type SupabaseConfig struct {
	BaseURL    string `mapstructure:"base_url"`
	ServiceKey string `mapstructure:"service_key"`
}

type Svix added in v1.0.18

type Svix struct {
	Enabled   bool   `mapstructure:"enabled"`
	AuthToken string `mapstructure:"auth_token"`
	BaseURL   string `mapstructure:"base_url"`
}

type TemporalConfig

type TemporalConfig struct {
	Address    string `mapstructure:"address" validate:"required"`
	TaskQueue  string `mapstructure:"task_queue" validate:"required"`
	Namespace  string `mapstructure:"namespace" validate:"required"`
	APIKey     string `mapstructure:"api_key"`
	APIKeyName string `mapstructure:"api_key_name"`
	TLS        bool   `mapstructure:"tls"`
}

type TenantWebhookConfig

type TenantWebhookConfig struct {
	Endpoint       string            `mapstructure:"endpoint"`
	Headers        map[string]string `mapstructure:"headers"`
	Enabled        bool              `mapstructure:"enabled"`
	ExcludedEvents []string          `mapstructure:"excluded_events"`
}

TenantWebhookConfig represents webhook configuration for a specific tenant

type Webhook

type Webhook struct {
	Enabled         bool                           `mapstructure:"enabled"`
	Topic           string                         `mapstructure:"topic" default:"webhooks"`
	PubSub          types.PubSubType               `mapstructure:"pubsub" default:"kafka"`
	ConsumerGroup   string                         `mapstructure:"consumer_group" default:"webhook-consumer"`
	MaxRetries      int                            `mapstructure:"max_retries" default:"3"`
	InitialInterval time.Duration                  `mapstructure:"initial_interval" default:"1s"`
	MaxInterval     time.Duration                  `mapstructure:"max_interval" default:"10s"`
	Multiplier      float64                        `mapstructure:"multiplier" default:"2.0"`
	MaxElapsedTime  time.Duration                  `mapstructure:"max_elapsed_time" default:"2m"`
	Tenants         map[string]TenantWebhookConfig `mapstructure:"tenants"`
	Svix            Svix                           `mapstructure:"svix_config"`
}

Webhook represents the configuration for the webhook system

Jump to

Keyboard shortcuts

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