config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLogConfig

type AuditLogConfig struct {
	Enabled     bool          `json:"enabled"`
	Destination string        `json:"destination"`
	Format      string        `json:"format"`
	Retention   time.Duration `json:"retention"`
}

AuditLogConfig holds audit log configuration

type BatchConfig

type BatchConfig struct {
	Concurrency       int           `json:"concurrency"`
	BatchSize         int           `json:"batch_size"`
	MaxBatchSize      int           `json:"max_batch_size"`
	ProcessingTimeout time.Duration `json:"processing_timeout"`
	RetentionPeriod   time.Duration `json:"retention_period"`
}

BatchConfig holds batch processing configuration

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `json:"allowed_origins"`
	AllowedMethods []string `json:"allowed_methods"`
	AllowedHeaders []string `json:"allowed_headers"`
}

CORSConfig holds CORS configuration

type ClickHouseConfig

type ClickHouseConfig struct {
	Host            string        `json:"host"`
	Port            int           `json:"port"`
	Database        string        `json:"database"`
	Username        string        `json:"username"`
	Password        string        `json:"password"`
	MaxOpenConns    int           `json:"max_open_conns"`
	MaxIdleConns    int           `json:"max_idle_conns"`
	ConnMaxLifetime time.Duration `json:"conn_max_lifetime"`
	Cluster         string        `json:"cluster"`
}

ClickHouseConfig holds ClickHouse configuration

type Config

type Config struct {
	Environment string           `json:"environment"`
	Version     string           `json:"version"`
	LogLevel    string           `json:"log_level"`
	Server      ServerConfig     `json:"server"`
	Database    DatabaseConfig   `json:"database"`
	Redis       RedisConfig      `json:"redis"`
	Queue       QueueConfig      `json:"queue"`
	Batch       BatchConfig      `json:"batch"`
	ML          MLConfig         `json:"ml"`
	Security    SecurityConfig   `json:"security"`
	Monitoring  MonitoringConfig `json:"monitoring"`
	Storage     StorageConfig    `json:"storage"`
	WebSocket   WebSocketConfig  `json:"websocket"`
	RateLimit   RateLimitConfig  `json:"rate_limit"`
}

Config holds all configuration for the Typosentinel application

func Load

func Load() (*Config, error)

Load loads configuration from environment variables and .env file

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type ContinuousLearningConfig

type ContinuousLearningConfig struct {
	Enabled              bool          `json:"enabled"`
	RetrainingInterval   time.Duration `json:"retraining_interval"`
	MinFeedbackCount     int           `json:"min_feedback_count"`
	ValidationSplit      float64       `json:"validation_split"`
	PerformanceThreshold float64       `json:"performance_threshold"`
}

ContinuousLearningConfig holds continuous learning configuration

type DatabaseConfig

type DatabaseConfig struct {
	PostgreSQL PostgreSQLConfig `json:"postgresql"`
	ClickHouse ClickHouseConfig `json:"clickhouse"`
	Migrations MigrationsConfig `json:"migrations"`
}

DatabaseConfig holds database configuration

type EncryptionConfig

type EncryptionConfig struct {
	Key         string                      `json:"key"`
	Algorithm   string                      `json:"algorithm"`
	KeyRotation EncryptionKeyRotationConfig `json:"key_rotation"`
}

EncryptionConfig holds encryption configuration

type EncryptionKeyRotationConfig

type EncryptionKeyRotationConfig struct {
	Enabled  bool          `json:"enabled"`
	Interval time.Duration `json:"interval"`
}

EncryptionKeyRotationConfig holds key rotation configuration

type HealthCheckConfig

type HealthCheckConfig struct {
	Enabled  bool          `json:"enabled"`
	Interval time.Duration `json:"interval"`
	Timeout  time.Duration `json:"timeout"`
	Endpoint string        `json:"endpoint"`
}

HealthCheckConfig holds health check configuration

type JWTConfig

type JWTConfig struct {
	Secret            string        `json:"secret"`
	Expiration        time.Duration `json:"expiration"`
	RefreshExpiration time.Duration `json:"refresh_expiration"`
	Issuer            string        `json:"issuer"`
	Audience          string        `json:"audience"`
}

JWTConfig holds JWT configuration

type JaegerConfig

type JaegerConfig struct {
	Enabled     bool    `json:"enabled"`
	Endpoint    string  `json:"endpoint"`
	ServiceName string  `json:"service_name"`
	SampleRate  float64 `json:"sample_rate"`
}

JaegerConfig holds Jaeger configuration

type LocalStorageConfig

type LocalStorageConfig struct {
	Enabled   bool          `json:"enabled"`
	BasePath  string        `json:"base_path"`
	MaxSize   int64         `json:"max_size"`
	Retention time.Duration `json:"retention"`
}

LocalStorageConfig holds local storage configuration

type LogRotationConfig

type LogRotationConfig struct {
	Enabled    bool `json:"enabled"`
	MaxSize    int  `json:"max_size"`
	MaxAge     int  `json:"max_age"`
	MaxBackups int  `json:"max_backups"`
	Compress   bool `json:"compress"`
}

LogRotationConfig holds log rotation configuration

type LoggingConfig

type LoggingConfig struct {
	Level      string            `json:"level"`
	Format     string            `json:"format"`
	Output     string            `json:"output"`
	Rotation   LogRotationConfig `json:"rotation"`
	Structured bool              `json:"structured"`
}

LoggingConfig holds logging configuration

type MLConfig

type MLConfig struct {
	Enabled            bool                     `json:"enabled"`
	ModelPath          string                   `json:"model_path"`
	PredictionTimeout  time.Duration            `json:"prediction_timeout"`
	BatchPrediction    bool                     `json:"batch_prediction"`
	BatchSize          int                      `json:"batch_size"`
	ContinuousLearning ContinuousLearningConfig `json:"continuous_learning"`
	Models             map[string]ModelConfig   `json:"models"`
}

MLConfig holds machine learning configuration

type MigrationsConfig

type MigrationsConfig struct {
	Enabled   bool   `json:"enabled"`
	Directory string `json:"directory"`
	Table     string `json:"table"`
}

MigrationsConfig holds database migrations configuration

type MinIOConfig

type MinIOConfig struct {
	Endpoint        string `json:"endpoint"`
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	UseSSL          bool   `json:"use_ssl"`
	BucketName      string `json:"bucket_name"`
	Region          string `json:"region"`
}

MinIOConfig holds MinIO configuration

type ModelConfig

type ModelConfig struct {
	Enabled     bool    `json:"enabled"`
	Version     string  `json:"version"`
	Weight      float64 `json:"weight"`
	Threshold   float64 `json:"threshold"`
	MaxFeatures int     `json:"max_features"`
}

ModelConfig holds individual model configuration

type MonitoringConfig

type MonitoringConfig struct {
	Enabled     bool              `json:"enabled"`
	Prometheus  PrometheusConfig  `json:"prometheus"`
	Jaeger      JaegerConfig      `json:"jaeger"`
	Logging     LoggingConfig     `json:"logging"`
	HealthCheck HealthCheckConfig `json:"health_check"`
}

MonitoringConfig holds monitoring configuration

type PostgreSQLConfig

type PostgreSQLConfig struct {
	Host            string          `json:"host"`
	Port            int             `json:"port"`
	Database        string          `json:"database"`
	Username        string          `json:"username"`
	Password        string          `json:"password"`
	SSLMode         string          `json:"ssl_mode"`
	MaxOpenConns    int             `json:"max_open_conns"`
	MaxIdleConns    int             `json:"max_idle_conns"`
	ConnMaxLifetime time.Duration   `json:"conn_max_lifetime"`
	ConnMaxIdleTime time.Duration   `json:"conn_max_idle_time"`
	Replicas        []ReplicaConfig `json:"replicas"`
}

PostgreSQLConfig holds PostgreSQL configuration

type PrometheusConfig

type PrometheusConfig struct {
	Enabled   bool   `json:"enabled"`
	Port      int    `json:"port"`
	Path      string `json:"path"`
	Namespace string `json:"namespace"`
	Subsystem string `json:"subsystem"`
}

PrometheusConfig holds Prometheus configuration

type QueueConfig

type QueueConfig struct {
	Workers           int           `json:"workers"`
	MaxRetries        int           `json:"max_retries"`
	RetryDelay        time.Duration `json:"retry_delay"`
	VisibilityTimeout time.Duration `json:"visibility_timeout"`
	PollInterval      time.Duration `json:"poll_interval"`
	Priorities        []string      `json:"priorities"`
	DeadLetterQueue   bool          `json:"dead_letter_queue"`
}

QueueConfig holds queue configuration

type RateLimitConfig

type RateLimitConfig struct {
	Enabled           bool                     `json:"enabled"`
	RequestsPerMinute int                      `json:"requests_per_minute"`
	BurstSize         int                      `json:"burst_size"`
	WindowSize        time.Duration            `json:"window_size"`
	CleanupInterval   time.Duration            `json:"cleanup_interval"`
	Tiers             map[string]RateLimitTier `json:"tiers"`
}

RateLimitConfig holds rate limiting configuration

type RateLimitTier

type RateLimitTier struct {
	RequestsPerMinute int `json:"requests_per_minute"`
	RequestsPerHour   int `json:"requests_per_hour"`
	RequestsPerDay    int `json:"requests_per_day"`
	BurstSize         int `json:"burst_size"`
}

RateLimitTier holds rate limit tier configuration

type RedisClusterConfig

type RedisClusterConfig struct {
	Enabled   bool     `json:"enabled"`
	Addresses []string `json:"addresses"`
}

RedisClusterConfig holds Redis cluster configuration

type RedisConfig

type RedisConfig struct {
	Address      string              `json:"address"`
	Password     string              `json:"password"`
	DB           int                 `json:"db"`
	PoolSize     int                 `json:"pool_size"`
	MinIdleConns int                 `json:"min_idle_conns"`
	DialTimeout  time.Duration       `json:"dial_timeout"`
	ReadTimeout  time.Duration       `json:"read_timeout"`
	WriteTimeout time.Duration       `json:"write_timeout"`
	IdleTimeout  time.Duration       `json:"idle_timeout"`
	Cluster      RedisClusterConfig  `json:"cluster"`
	Sentinel     RedisSentinelConfig `json:"sentinel"`
}

RedisConfig holds Redis configuration

type RedisSentinelConfig

type RedisSentinelConfig struct {
	Enabled    bool     `json:"enabled"`
	MasterName string   `json:"master_name"`
	Sentinels  []string `json:"sentinels"`
	Password   string   `json:"password"`
}

RedisSentinelConfig holds Redis Sentinel configuration

type ReplicaConfig

type ReplicaConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Weight   int    `json:"weight"`
	ReadOnly bool   `json:"read_only"`
}

ReplicaConfig holds database replica configuration

type SecurityConfig

type SecurityConfig struct {
	JWT             JWTConfig             `json:"jwt"`
	RateLimit       RateLimitConfig       `json:"rate_limit"`
	Encryption      EncryptionConfig      `json:"encryption"`
	AuditLog        AuditLogConfig        `json:"audit_log"`
	ThreatDetection ThreatDetectionConfig `json:"threat_detection"`
}

SecurityConfig holds security configuration

type ServerConfig

type ServerConfig struct {
	Port         int           `json:"port"`
	Host         string        `json:"host"`
	ReadTimeout  time.Duration `json:"read_timeout"`
	WriteTimeout time.Duration `json:"write_timeout"`
	IdleTimeout  time.Duration `json:"idle_timeout"`
	TLS          TLSConfig     `json:"tls"`
	CORS         CORSConfig    `json:"cors"`
}

ServerConfig holds HTTP server configuration

type StorageConfig

type StorageConfig struct {
	MinIO MinIOConfig        `json:"minio"`
	Local LocalStorageConfig `json:"local"`
}

StorageConfig holds storage configuration

type TLSConfig

type TLSConfig struct {
	Enabled  bool   `json:"enabled"`
	CertFile string `json:"cert_file"`
	KeyFile  string `json:"key_file"`
}

TLSConfig holds TLS configuration

type ThreatDetectionConfig

type ThreatDetectionConfig struct {
	Enabled            bool          `json:"enabled"`
	RealTimeScanning   bool          `json:"real_time_scanning"`
	ScanTimeout        time.Duration `json:"scan_timeout"`
	MaxConcurrentScans int           `json:"max_concurrent_scans"`
	QuarantineEnabled  bool          `json:"quarantine_enabled"`
}

ThreatDetectionConfig holds threat detection configuration

type WebSocketConfig

type WebSocketConfig struct {
	Enabled         bool          `json:"enabled"`
	ReadBufferSize  int           `json:"read_buffer_size"`
	WriteBufferSize int           `json:"write_buffer_size"`
	PingPeriod      time.Duration `json:"ping_period"`
	PongWait        time.Duration `json:"pong_wait"`
	WriteWait       time.Duration `json:"write_wait"`
	MaxMessageSize  int64         `json:"max_message_size"`
	Compression     bool          `json:"compression"`
}

WebSocketConfig holds WebSocket configuration

Jump to

Keyboard shortcuts

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