config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromEnv

func LoadFromEnv(cfg *Config)

LoadFromEnv loads configuration from environment variables

Types

type Config

type Config struct {
	// Server configuration
	Host string
	Port int

	// Storage configuration
	StorageType string // "jsonfile" or "sqlite"
	BaseDir     string
	SchemaDir   string
	Schema      string
	DBPath      string // SQLite database path

	// Cache configuration
	CacheType string // "memory" or "redis"
	CacheTTL  int    // seconds
	RedisHost string
	RedisPort int
	CacheSize int

	// Graph configuration
	GraphEnabled        bool
	GraphMode           string // "indexed" or "disabled"
	GraphDataFile       string
	GraphIndexFile      string
	GraphQueryTTL       int
	GraphResultTTL      int
	GraphCycleDetection string // "warn", "error", "ignore"

	// Full-text search
	FullTextEnabled bool

	// Query configuration
	MaxQueryDepth   int
	MaxEmbedDepth   int
	RefEmbedDepth   int
	DefaultPageSize int

	// Entity configuration
	PatchNullBehavior string // "store" or "delete"
	MaxEntitySize     int    // bytes

	// Cascade delete configuration
	CascadingDelete     bool
	MaxCascadeDeletions int
	MaxCascadeWork      int

	// Debug
	Debug      bool
	DebugLocks bool

	// Authentication
	AuthType         string   // "none", "jwt", "apikey"
	JWTSecret        string   // Secret for JWT validation
	JWTIssuer        string   // Expected issuer claim
	APIKeys          []string // Valid API keys (comma-separated in env)
	AuthExcludePaths []string // Paths excluded from auth (e.g., /health)

	// Rate limiting
	RateLimitEnabled bool
	RateLimitRate    int // Requests per window
	RateLimitWindow  int // Window in seconds
	RateLimitByIP    bool
	RateLimitByKey   bool // Rate limit by API key or JWT subject

	// Metrics
	MetricsEnabled bool

	// Multi-tenancy
	// TenantMode controls tenant isolation behaviour:
	//   "none"   - No tenant features (default)
	//   "path"   - Tenant routes available, non-tenant routes also work
	//   "strict" - All entity requests require tenant context; non-tenant routes return 403
	TenantMode string
}

Config holds application configuration

func Default

func Default() *Config

Default returns the default configuration

Jump to

Keyboard shortcuts

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