config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: GPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads and validates application configuration from environment variables.

Index

Constants

View Source
const (
	EnvProduction = "production"
)

Environment constants

Variables

This section is empty.

Functions

This section is empty.

Types

type AITriageConfig

type AITriageConfig struct {
	// Enabled controls whether AI triage feature is available platform-wide.
	Enabled bool

	// Platform AI Provider Configuration
	// Used when tenants choose "platform" mode (don't provide their own keys)
	PlatformProvider string // "claude", "openai", or "gemini"
	PlatformModel    string // e.g., "claude-3-5-sonnet-20241022", "gemini-1.5-pro"
	AnthropicAPIKey  string // Platform's Anthropic API key
	OpenAIAPIKey     string // Platform's OpenAI API key
	GeminiAPIKey     string // Platform's Google Gemini API key

	// Rate Limiting
	MaxConcurrentJobs int // Max concurrent AI triage jobs
	RateLimitRPM      int // Rate limit per minute
	TimeoutSeconds    int // Timeout for AI API calls
	MaxTokens         int // Max tokens per request

	// LLM Parameters
	Temperature float64 // Temperature for LLM (0.0-1.0, lower = more deterministic)

	// Default Auto-Triage Settings (can be overridden per tenant)
	DefaultAutoTriageEnabled    bool
	DefaultAutoTriageSeverities []string
	DefaultAutoTriageDelay      time.Duration

	// Stuck Job Recovery Settings
	RecoveryEnabled       bool          // Enable background recovery for stuck jobs
	RecoveryInterval      time.Duration // How often to check for stuck jobs (default: 5 minutes)
	RecoveryStuckDuration time.Duration // How long before a job is considered stuck (default: 15 minutes)
	RecoveryBatchSize     int           // Max jobs to recover per run (default: 50)

	// Per-tenant LLM token budget (RFC-008 Phase 1).
	// BudgetEnabled defaults to false — the budget service is wired
	// but Check() returns nil so no tenant is blocked. Flip to true
	// per RFC-008 Phase 2 rollout after backfill + dashboards ship.
	BudgetEnabled bool
	// BudgetStrict controls the fail-mode when the budget repo is
	// unreachable. In production (strict=true) a repo outage blocks
	// triage — we refuse to run without a running counter. In dev/
	// staging (strict=false) we log and proceed. Defaults to false
	// to match "flag off = zero behaviour change" on first deploy.
	BudgetStrict bool
	// BudgetDefaultTokensPerMonth is the fallback ceiling applied when
	// a tenant has no row in ai_triage_budgets for the current month
	// AND no per-plan override. 0 = unlimited (back-compat). A paying
	// SaaS deployment typically sets this at plan-onboarding time,
	// not here.
	BudgetDefaultTokensPerMonth int64
}

AITriageConfig holds AI triage configuration for the platform. This is the platform-level configuration. Tenant-specific settings are stored in tenant.Settings.AI.

func (*AITriageConfig) IsConfigured

func (c *AITriageConfig) IsConfigured() bool

IsConfigured returns true if AI triage is properly configured. This checks if at least one LLM provider API key is set. Note: The Enabled field is deprecated - feature availability is now controlled by the module's is_active field in the database.

type AdminAuditRetentionConfig added in v0.4.0

type AdminAuditRetentionConfig struct {
	// Enabled registers the controller at all. Default true — in dry-run
	// mode it only reports, which is what makes the growth visible.
	// ADMIN_AUDIT_RETENTION_ENABLED
	Enabled bool

	// DryRun reports the row count instead of deleting. Default TRUE.
	// ADMIN_AUDIT_RETENTION_DRY_RUN
	DryRun bool

	// RetentionDays is the age threshold. Default 365.
	// ADMIN_AUDIT_RETENTION_DAYS
	RetentionDays int

	// Interval is how often the sweep runs. Default 24h.
	// ADMIN_AUDIT_RETENTION_INTERVAL
	Interval time.Duration

	// BatchSize bounds one delete transaction. Default 10000.
	// ADMIN_AUDIT_RETENTION_BATCH_SIZE
	BatchSize int
}

AdminAuditRetentionConfig controls the admin-audit-log retention controller.

admin_audit_logs is append-only and every platform-admin action writes a row, so without pruning the table grows forever. Deletion is irreversible and compliance-relevant (SOC 2 / PCI DSS want >= 1 year), so the controller ships in dry-run mode: it reports what it WOULD delete and deletes nothing until an operator sets ADMIN_AUDIT_RETENTION_DRY_RUN=false. That keeps an upgrade from silently destroying audit history, while making the retention policy an actual switch instead of a compiled-in constant.

type AgentConfig

type AgentConfig struct {
	// HeartbeatTimeout is the duration after which an agent is marked as inactive
	// if no heartbeat is received. Default: 5 minutes.
	HeartbeatTimeout time.Duration

	// HealthCheckInterval is how often to check for stale agents.
	// Default: 1 minute.
	HealthCheckInterval time.Duration

	// Enabled controls whether agent health checking is enabled.
	// Default: true.
	Enabled bool

	// SCMSyncInterval is how often the scheduled SCM repository/branch sync runs.
	// 0 (default) disables it — repositories are then only imported on demand via
	// POST /integrations/{id}/import-repositories. Set SCM_SYNC_INTERVAL (e.g. 6h)
	// to enable periodic auto-import + branch sync + expired-token detection.
	SCMSyncInterval time.Duration

	// CTEMIDFeedURL is the CTEM-ID catalog feed the daily ctem-id-refresh
	// controller mirrors into local reference storage. Behind the same
	// feed-refresh machinery as the EPSS/KEV threat-intel refresh. Set
	// CTEM_ID_FEED_URL to override; defaults to https://ctem.org/source.json.
	CTEMIDFeedURL string

	// CertMonitorEnabled toggles the Certificate-Transparency discovery sweep
	// (the cert-monitor controller). Default true — it is a passive, public-data,
	// no-credentials external-exposure source. Set CERT_MONITOR_ENABLED=false to
	// disable outbound crt.sh polling entirely.
	CertMonitorEnabled bool

	// CertMonitorFeedBaseURL is the CT-log aggregator the cert-monitor controller
	// queries per tenant domain. Set CERT_MONITOR_FEED_URL to override; defaults
	// to https://crt.sh. Queried via the SSRF-guarded SafeHTTPClient.
	CertMonitorFeedBaseURL string

	// CertMonitorInterval is how often the CT sweep runs across all tenants.
	// Defaults to 24h (daily), matching the threat-intel / CTEM-ID refreshes.
	CertMonitorInterval time.Duration

	// LoadBalancing holds configuration for agent load balancing weights.
	LoadBalancing LoadBalancingConfig
}

AgentConfig holds agent management configuration.

type AgentConfigConfig added in v0.1.5

type AgentConfigConfig struct {
	// TemplatesDir is the filesystem path containing agent config templates
	// (yaml.tmpl, env.tmpl, docker.tmpl, cli.tmpl). Operators can edit these
	// without rebuilding the API or UI.
	// Default: configs/agent-templates
	TemplatesDir string
	// PublicAPIURL is the URL agents will connect to (embedded in templates).
	// If empty, falls back to App.URL.
	PublicAPIURL string
	// KeyTTL is how long a self-renewed agent API key stays valid before it
	// must be renewed again (RFC-014 Phase 1b). Zero (the default) disables
	// expiry: renewed keys never expire. Set AGENT_KEY_TTL (e.g. "24h") to opt
	// into short-lived, auto-rotating agent credentials.
	KeyTTL time.Duration
}

AgentConfigConfig holds the agent config template service settings.

type AppConfig

type AppConfig struct {
	Name  string
	Env   string
	Debug bool
	URL   string // Public app URL (used as fallback for agent config base URL)
}

AppConfig holds application-level configuration.

type AuthConfig

type AuthConfig struct {
	// Provider determines which authentication methods are available.
	// Values: "local", "oidc", "hybrid"
	Provider AuthProvider

	// JWT settings for local auth
	JWTSecret            string        // Secret key for signing JWTs (required for local/hybrid)
	JWTIssuer            string        // Token issuer claim
	AccessTokenDuration  time.Duration // Access token lifetime (default: 15m)
	RefreshTokenDuration time.Duration // Refresh token lifetime (default: 7d)
	SessionDuration      time.Duration // Session lifetime (default: 30d)

	// Password policy
	PasswordMinLength      int  // Minimum password length (default: 8)
	PasswordRequireUpper   bool // Require uppercase letter
	PasswordRequireLower   bool // Require lowercase letter
	PasswordRequireNumber  bool // Require number
	PasswordRequireSpecial bool // Require special character

	// Security settings
	MaxLoginAttempts  int           // Max failed attempts before lockout (default: 5)
	LockoutDuration   time.Duration // Account lockout duration (default: 15m)
	MaxActiveSessions int           // Max concurrent sessions per user (default: 10)

	// Registration settings
	AllowRegistration        bool // Allow new user registration (default: true)
	RequireEmailVerification bool // Require email verification (default: true)

	// Email verification/reset token settings
	EmailVerificationDuration time.Duration // Email verification token lifetime (default: 24h)
	PasswordResetDuration     time.Duration // Password reset token lifetime (default: 1h)

	// Cookie settings for tokens (security best practice)
	CookieSecure           bool   // Use Secure flag (HTTPS only) - should be true in production
	CookieDomain           string // Cookie domain (empty = current host)
	CookieSameSite         string // SameSite policy: "strict", "lax", or "none"
	AccessTokenCookieName  string // Cookie name for access token (default: "auth_token")
	RefreshTokenCookieName string // Cookie name for refresh token (default: "refresh_token")
	TenantCookieName       string // Cookie name for tenant (default: "app_tenant")

	// EntraSSO is the platform-wide Microsoft Entra ID SSO fallback. When a
	// tenant has NOT configured its own entra_id identity provider, the SSO
	// flow falls back to this shared config (if Enabled). A tenant's own
	// provider always takes precedence.
	EntraSSO EntraSSOConfig

	// AllowedRedirectURIs is the exact-match allow-list for the caller-supplied
	// redirect_uri of the per-tenant SSO OIDC flow (SSO_ALLOWED_REDIRECT_URIS,
	// csv). It is the OAuth 2.1 / RFC 9700 open-redirect guard: the frontend
	// callback the SSO flow returns to must match one of these entries exactly.
	// Each entry is a trusted frontend origin (scheme+host[:port], authorizing
	// any path on that exact origin) or an origin+path prefix (ending in "/",
	// restricting to that path). No wildcards, no suffix matching. When left
	// empty at load time it is derived from the configured frontend origins
	// (CORS allowed origins + OAuth frontend callback) so the shipped UI keeps
	// working; an empty list at request time fails closed (rejects every URI).
	AllowedRedirectURIs []string
}

AuthConfig holds authentication configuration.

type AuthProvider

type AuthProvider string

AuthProvider represents the authentication provider type.

const (
	// AuthProviderLocal uses built-in email/password authentication.
	AuthProviderLocal AuthProvider = "local"
	// AuthProviderOIDC uses external OIDC provider (Keycloak).
	AuthProviderOIDC AuthProvider = "oidc"
	// AuthProviderHybrid allows both local and OIDC authentication.
	AuthProviderHybrid AuthProvider = "hybrid"
)

func (AuthProvider) IsValid

func (p AuthProvider) IsValid() bool

IsValid checks if the auth provider is valid.

func (AuthProvider) SupportsLocal

func (p AuthProvider) SupportsLocal() bool

SupportsLocal returns true if local auth is supported.

func (AuthProvider) SupportsOIDC

func (p AuthProvider) SupportsOIDC() bool

SupportsOIDC returns true if OIDC auth is supported.

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string
	AllowedMethods []string
	AllowedHeaders []string
	MaxAge         int
}

CORSConfig holds CORS configuration.

type Config

type Config struct {
	App         AppConfig
	Server      ServerConfig
	GRPC        GRPCConfig
	Database    DatabaseConfig
	Redis       RedisConfig
	Log         LogConfig
	Auth        AuthConfig
	OAuth       OAuthConfig
	Keycloak    KeycloakConfig
	CORS        CORSConfig
	RateLimit   RateLimitConfig
	SMTP        SMTPConfig
	Worker      WorkerConfig
	Encryption  EncryptionConfig
	AITriage    AITriageConfig
	AgentConfig AgentConfigConfig
	Storage     StorageConfig
	Webhooks    WebhooksConfig
	Ingest      IngestConfig
	Metrics     MetricsConfig

	// AdminAuditRetention controls pruning of the platform-level
	// admin_audit_logs table.
	AdminAuditRetention AdminAuditRetentionConfig
}

Config holds all application configuration.

func Load

func Load() (*Config, error)

Load loads configuration from environment variables.

func (*Config) IsDevelopment

func (c *Config) IsDevelopment() bool

IsDevelopment returns true if the application is in development mode.

func (*Config) IsProduction

func (c *Config) IsProduction() bool

IsProduction returns true if the application is in production mode.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type DatabaseConfig

type DatabaseConfig struct {
	Host            string
	Port            int
	User            string
	Password        string
	Name            string
	SSLMode         string
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
}

DatabaseConfig holds database configuration.

func (*DatabaseConfig) DSN

func (c *DatabaseConfig) DSN() string

DSN returns the database connection string.

type EncryptionConfig

type EncryptionConfig struct {
	// Key is the encryption key for AES-256-GCM encryption of sensitive data.
	// Must be exactly 32 bytes (256 bits) when decoded.
	// Can be provided as:
	// - Raw 32-byte key
	// - Hex-encoded (64 characters)
	// - Base64-encoded (44 characters)
	Key string

	// KeyFormat specifies the format of the encryption key.
	// Values: "raw", "hex", "base64"
	// Default: auto-detected based on key length
	KeyFormat string

	// AllowPlaintext, when true, lets non-production deployments fall
	// back to plaintext credential storage if Key is empty. Required
	// to make the security trade-off intentional and visible — without
	// this opt-in, a missing APP_ENCRYPTION_KEY refuses to boot even
	// in dev. Production NEVER allows plaintext (initEncryptor enforces).
	// Env var: APP_ALLOW_PLAINTEXT_CREDENTIALS
	AllowPlaintext bool
}

EncryptionConfig holds encryption configuration for sensitive data.

func (*EncryptionConfig) IsConfigured

func (c *EncryptionConfig) IsConfigured() bool

IsConfigured returns true if encryption is configured.

type EntraSSOConfig added in v0.3.0

type EntraSSOConfig struct {
	Enabled        bool     // SSO_ENTRA_ENABLED
	ClientID       string   // SSO_ENTRA_CLIENT_ID
	ClientSecret   string   // SSO_ENTRA_CLIENT_SECRET (plaintext — env is the trust boundary)
	TenantID       string   // SSO_ENTRA_TENANT_ID (Entra directory id; default "common")
	AllowedDomains []string // SSO_ENTRA_ALLOWED_DOMAINS (csv; empty = any)
	DefaultRole    string   // SSO_ENTRA_DEFAULT_ROLE (default "member")
	AutoProvision  bool     // SSO_ENTRA_AUTO_PROVISION (default true)
	DisplayName    string   // SSO_ENTRA_DISPLAY_NAME (default "Microsoft Entra ID")

	// AllowedTenants is the opt-in allow-list of tenant SLUGS (SSO_ENTRA_ALLOWED_TENANTS,
	// csv) that may use this platform-wide env fallback. It is fail-closed: a tenant
	// whose slug is NOT listed gets NO env SSO button and NO env-fallback login, so a
	// shared multi-tenant (`/common`) app registration cannot let any Microsoft account
	// self-join every organization. Empty ⇒ the env fallback is disabled for all tenants.
	AllowedTenants []string // SSO_ENTRA_ALLOWED_TENANTS (csv of tenant slugs; empty = none)
}

EntraSSOConfig holds the platform-wide (env-based) Microsoft Entra ID SSO fallback used when a tenant has no entra_id provider of its own.

func (EntraSSOConfig) IsConfigured added in v0.3.0

func (c EntraSSOConfig) IsConfigured() bool

IsConfigured reports whether the platform-wide Entra SSO fallback is usable: enabled and carrying the minimum credentials to drive an OAuth code flow.

type GRPCConfig

type GRPCConfig struct {
	Port int
}

GRPCConfig holds gRPC server configuration.

type IngestConfig added in v0.3.0

type IngestConfig struct {
	// Mode is "sync" (default — process in the request) or "async" (enqueue +
	// 202, processed by the ingest worker). Async is opt-in per deployment.
	Mode string
	// MaxPendingPerTenant bounds a tenant's queue depth; further submissions get
	// 429 + Retry-After. 0 disables the check.
	MaxPendingPerTenant int
}

IngestConfig controls asynchronous ingest (RFC-005).

func (IngestConfig) AsyncEnabled added in v0.3.0

func (c IngestConfig) AsyncEnabled() bool

AsyncEnabled reports whether async ingest mode is on.

type KeycloakConfig

type KeycloakConfig struct {
	// BaseURL is the Keycloak server URL (e.g., "https://keycloak.example.com")
	BaseURL string
	// Realm is the Keycloak realm name
	Realm string
	// ClientID is the expected audience in tokens (optional, for audience validation)
	ClientID string
	// JWKSRefreshInterval is how often to refresh JWKS keys
	JWKSRefreshInterval time.Duration
	// HTTPTimeout is the timeout for HTTP requests to Keycloak
	HTTPTimeout time.Duration
}

KeycloakConfig holds Keycloak authentication configuration.

func (*KeycloakConfig) IssuerURL

func (c *KeycloakConfig) IssuerURL() string

IssuerURL returns the expected token issuer URL.

func (*KeycloakConfig) JWKSURL

func (c *KeycloakConfig) JWKSURL() string

JWKSURL returns the JWKS endpoint URL.

type LoadBalancingConfig

type LoadBalancingConfig struct {
	// JobWeight is the weight for job load factor (current_jobs/max_jobs * 100).
	// Default: 0.30 (30%)
	JobWeight float64

	// CPUWeight is the weight for CPU usage percentage.
	// Default: 0.40 (40%) - CPU is typically the most important metric
	CPUWeight float64

	// MemoryWeight is the weight for memory usage percentage.
	// Default: 0.15 (15%)
	MemoryWeight float64

	// DiskIOWeight is the weight for disk I/O score.
	// Default: 0.10 (10%)
	DiskIOWeight float64

	// NetworkWeight is the weight for network I/O score.
	// Default: 0.05 (5%)
	NetworkWeight float64

	// MaxDiskThroughputMBPS is the maximum expected disk throughput in MB/s.
	// Used to normalize disk I/O metrics to a 0-100 scale.
	// Default: 500 (500 MB/s combined read+write)
	MaxDiskThroughputMBPS float64

	// MaxNetworkThroughputMBPS is the maximum expected network throughput in MB/s.
	// Used to normalize network metrics to a 0-100 scale.
	// Default: 1000 (1 Gbps combined rx+tx)
	MaxNetworkThroughputMBPS float64
}

LoadBalancingConfig holds weights for agent load balancing score computation. The load score formula: score = (JobWeight * job_load) + (CPUWeight * cpu) +

(MemoryWeight * memory) + (DiskIOWeight * disk_io) + (NetworkWeight * network)

All weights should sum to 1.0 for meaningful percentage-based scoring. Lower score = better candidate for receiving new jobs.

func (LoadBalancingConfig) Weights added in v0.4.0

Weights converts the operator-facing AGENT_LB_* settings into the domain weight set consumed by Agent.ComputeLoadScoreWithWeights and the agent selector. This is the seam that makes those environment variables observable in scheduling behavior.

type LogConfig

type LogConfig struct {
	Level  string
	Format string

	// Sampling configuration for high-traffic production environments
	SamplingEnabled   bool    // Enable log sampling (default: false for dev, true for prod)
	SamplingThreshold int     // First N identical logs per second (default: 100)
	SamplingRate      float64 // Sample rate after threshold, 0.0-1.0 (default: 0.1 = 10%)
	ErrorSamplingRate float64 // Sample rate for errors, 0.0-1.0 (default: 1.0 = 100%)

	// HTTP logging configuration
	SkipHealthLogs     bool // Skip logging health check endpoints (default: true in prod)
	SlowRequestSeconds int  // Log requests slower than this as warnings (default: 5)
}

LogConfig holds logging configuration.

type MetricsConfig added in v0.4.0

type MetricsConfig struct {
	// Public leaves /metrics unauthenticated when true (legacy behavior).
	// Default false.
	Public bool
	// Token is the bearer token required to scrape /metrics when Public is
	// false. Empty + non-public = endpoint disabled (fail closed).
	Token string
}

MetricsConfig controls exposure of the Prometheus /metrics endpoint.

SECURITY: /metrics leaks internal cardinality (route names, error rates, build info) and is a reconnaissance aid, so it is NOT public by default. When Public is false (the default) the endpoint requires a bearer token (Token) supplied via the Authorization header, e.g.

Authorization: Bearer <METRICS_TOKEN>

Configure the scraper (Prometheus `authorization`/`bearer_token`) with the same value. If Public is false and Token is empty the endpoint fails closed (404) — metrics are effectively disabled until a token is set or Public is explicitly enabled. Set METRICS_PUBLIC=true to restore the legacy open endpoint (e.g. when it is already firewalled to an internal scrape network).

type OAuthConfig

type OAuthConfig struct {
	// Enabled controls whether OAuth login is enabled
	Enabled bool

	// FrontendCallbackURL is the frontend URL for OAuth callbacks
	// e.g., "http://localhost:3000/auth/callback"
	FrontendCallbackURL string

	// StateSecret is used to sign OAuth state tokens for CSRF protection
	StateSecret string

	// StateDuration is how long OAuth state tokens are valid
	StateDuration time.Duration

	// AllowedRedirectURLs is a whitelist of allowed OAuth redirect URLs.
	// If empty, only the FrontendCallbackURL origin is allowed.
	AllowedRedirectURLs []string

	// Providers
	Google    OAuthProviderConfig
	GitHub    OAuthProviderConfig
	Microsoft OAuthProviderConfig
}

OAuthConfig holds OAuth/Social login configuration.

func (*OAuthConfig) HasAnyProvider

func (c *OAuthConfig) HasAnyProvider() bool

HasAnyProvider returns true if any OAuth provider is enabled.

type OAuthProviderConfig

type OAuthProviderConfig struct {
	Enabled      bool
	ClientID     string
	ClientSecret string
	// Scopes are the OAuth scopes to request (optional, defaults provided)
	Scopes []string
}

OAuthProviderConfig holds configuration for a single OAuth provider.

func (*OAuthProviderConfig) IsConfigured

func (c *OAuthProviderConfig) IsConfigured() bool

IsConfigured returns true if the provider is properly configured.

type RateLimitConfig

type RateLimitConfig struct {
	Enabled         bool
	RequestsPerSec  float64
	Burst           int
	CleanupInterval time.Duration
}

RateLimitConfig holds rate limiting configuration.

type RedisConfig

type RedisConfig struct {
	Host          string
	Port          int
	Password      string
	DB            int
	PoolSize      int
	MinIdleConns  int
	DialTimeout   time.Duration
	ReadTimeout   time.Duration
	WriteTimeout  time.Duration
	TLSEnabled    bool
	TLSSkipVerify bool
	TLSCertFile   string // Path to TLS certificate file (optional, for mTLS)
	TLSKeyFile    string // Path to TLS key file (optional, for mTLS)
	TLSCAFile     string // Path to CA certificate file (optional, for custom CA)
	MaxRetries    int
	MinRetryDelay time.Duration
	MaxRetryDelay time.Duration
}

RedisConfig holds Redis configuration.

func (*RedisConfig) Addr

func (c *RedisConfig) Addr() string

Addr returns the Redis address.

type SMTPConfig

type SMTPConfig struct {
	Host       string
	Port       int
	User       string
	Password   string
	From       string
	FromName   string
	TLS        bool
	SkipVerify bool
	Enabled    bool
	BaseURL    string // Frontend base URL for email links (e.g., https://app.openctem.io)
	Timeout    time.Duration
}

SMTPConfig holds SMTP configuration for sending emails.

func (*SMTPConfig) IsConfigured

func (c *SMTPConfig) IsConfigured() bool

IsConfigured returns true if SMTP is properly configured.

type ServerConfig

type ServerConfig struct {
	Host                  string
	Port                  int
	ReadTimeout           time.Duration
	WriteTimeout          time.Duration
	RequestTimeout        time.Duration // Per-request handler timeout
	ShutdownTimeout       time.Duration
	MaxBodySize           int64
	SessionTimeoutMinutes int // Session timeout in minutes (0 = disabled, default: 30)
	MaxConcurrentRequests int // Maximum concurrent requests (default: 1000)
	// TrustedProxies is the list of CIDR ranges (or bare IPs) whose
	// X-Real-IP / X-Forwarded-For headers will be honored. Requests from
	// peers outside this list have their forwarding headers ignored —
	// preventing IP spoofing of rate-limit and audit-log keys (S-4).
	// Empty list = treat the API as directly Internet-facing.
	// Configure via SERVER_TRUSTED_PROXIES (comma-separated CIDRs).
	TrustedProxies []string
}

ServerConfig holds HTTP server configuration.

func (*ServerConfig) Addr

func (c *ServerConfig) Addr() string

Addr returns the HTTP server address.

type StorageConfig added in v0.1.6

type StorageConfig struct {
	// Provider selects the storage backend: "local" (default), "s3", "minio"
	Provider string
	// LocalPath is the filesystem path for the "local" provider.
	// Default: ./data/attachments
	// In Docker: mount a volume to persist across container rebuilds.
	LocalPath string
	// S3/MinIO settings (future)
	Bucket    string
	Region    string
	Endpoint  string
	AccessKey string
	SecretKey string
}

StorageConfig holds file attachment storage settings. Default: local filesystem at ./data/attachments. Future: S3, MinIO, GCS via provider selection per-tenant.

type WebhooksConfig added in v0.2.0

type WebhooksConfig struct {
	// JiraSecret is the HMAC-SHA256 secret used to verify inbound Jira webhooks
	// at POST /api/v1/webhooks/incoming/jira. REQUIRED — if empty, the endpoint
	// rejects all requests (fail closed).
	JiraSecret string
}

WebhooksConfig holds shared secrets for incoming webhook HMAC verification (F-1). These are platform-wide fallbacks; per-integration secrets can be layered on top via the integration repository when that abstraction is added.

type WorkerConfig

type WorkerConfig = AgentConfig

WorkerConfig holds worker/agent management configuration. Deprecated: Use AgentConfig instead. This alias is kept for backward compatibility.

Jump to

Keyboard shortcuts

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