config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const BuiltInMode = "c2hlbgo"

BuiltInMode represents a special build tag for built-in extension mode To enable built-in mode, build or run with tag: go build/run -tags="c2hlbgo"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Mode      string   `json:"mode" yaml:"mode"`
	Path      string   `json:"path" yaml:"path"`
	Includes  []string `json:"includes" yaml:"includes"`
	Excludes  []string `json:"excludes" yaml:"excludes"`
	HotReload bool     `json:"hot_reload" yaml:"hot_reload"`

	MaxPlugins   int            `json:"max_plugins" yaml:"max_plugins"`
	PluginConfig map[string]any `json:"plugin_config" yaml:"plugin_config"`

	Security    *SecurityConfig    `json:"security" yaml:"security"`
	Performance *PerformanceConfig `json:"performance" yaml:"performance"`
	Metrics     *MetricsConfig     `json:"metrics" yaml:"metrics"`
}

Config extension config struct

func GetConfig

func GetConfig(v *viper.Viper) *Config

GetConfig returns extension config from viper

func (*Config) IsBuiltInMode

func (c *Config) IsBuiltInMode() bool

IsBuiltInMode checks if running in built-in mode

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type MetricsConfig

type MetricsConfig struct {
	Enabled       bool           `json:"enabled" yaml:"enabled"`
	FlushInterval string         `json:"flush_interval" yaml:"flush_interval"`
	BatchSize     int            `json:"batch_size" yaml:"batch_size"`
	Retention     string         `json:"retention" yaml:"retention"`
	Storage       *StorageConfig `json:"storage" yaml:"storage"`
}

MetricsConfig metrics configuration

func (*MetricsConfig) GetRetentionDuration

func (m *MetricsConfig) GetRetentionDuration() (time.Duration, error)

GetRetentionDuration returns the retention duration

func (*MetricsConfig) Validate

func (m *MetricsConfig) Validate() error

Validate validates the metrics configuration

type PerformanceConfig

type PerformanceConfig struct {
	MaxMemoryMB            int    `json:"max_memory_mb" yaml:"max_memory_mb"`
	MaxCPUPercent          int    `json:"max_cpu_percent" yaml:"max_cpu_percent"`
	GarbageCollectInterval string `json:"gc_interval" yaml:"gc_interval"`
	MaxConcurrentLoads     int    `json:"max_concurrent_loads" yaml:"max_concurrent_loads"`
}

PerformanceConfig performance settings

type SecurityConfig

type SecurityConfig struct {
	EnableSandbox     bool     `json:"enable_sandbox" yaml:"enable_sandbox"`
	AllowedPaths      []string `json:"allowed_paths" yaml:"allowed_paths"`
	BlockedExtensions []string `json:"blocked_extensions" yaml:"blocked_extensions"`
	TrustedSources    []string `json:"trusted_sources" yaml:"trusted_sources"`
	RequireSignature  bool     `json:"require_signature" yaml:"require_signature"`
	AllowUnsafe       bool     `json:"allow_unsafe" yaml:"allow_unsafe"`
}

SecurityConfig security settings

type StorageConfig

type StorageConfig struct {
	Type      string            `json:"type" yaml:"type"`
	KeyPrefix string            `json:"key_prefix" yaml:"key_prefix"`
	Options   map[string]string `json:"options" yaml:"options"`
}

StorageConfig metrics storage configuration

Jump to

Keyboard shortcuts

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