config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config provides configuration management for agent applications. It supports loading from environment variables with sensible defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultModel

func GetDefaultModel(provider string) string

GetDefaultModel returns the default model for a given provider.

Types

type Config

type Config struct {
	// LLM Configuration
	LLMProvider string // "gemini", "claude", "openai", "ollama", "xai"
	LLMAPIKey   string
	LLMModel    string
	LLMBaseURL  string // For Ollama or custom endpoints

	// Provider-specific API keys
	GeminiAPIKey string
	ClaudeAPIKey string
	OpenAIAPIKey string
	XAIAPIKey    string
	OllamaURL    string

	// Search Configuration
	SearchProvider string // "serper", "serpapi"
	SerperAPIKey   string
	SerpAPIKey     string

	// Agent URLs (for multi-agent systems)
	AgentURLs map[string]string

	// A2A Protocol Configuration
	A2AEnabled   bool
	A2AAuthType  string // "jwt", "apikey", "oauth2"
	A2AAuthToken string

	// Observability Configuration
	ObservabilityEnabled  bool   // Enable LLM observability
	ObservabilityProvider string // "opik", "langfuse", "phoenix"
	ObservabilityAPIKey   string
	ObservabilityEndpoint string // Custom endpoint (optional)
	ObservabilityProject  string // Project name for grouping traces

	// Security Configuration
	SecurityEnabled      bool // Enable VaultGuard security checks
	SecurityMinScore     int  // Minimum security score (0-100)
	SecurityRequireEncry bool // Require disk encryption
}

Config holds the application configuration.

func LoadConfig

func LoadConfig() *Config

LoadConfig loads configuration from environment variables.

func (*Config) GetAgentURL

func (c *Config) GetAgentURL(name string) string

GetAgentURL gets the URL for a named agent.

func (*Config) SetAgentURL

func (c *Config) SetAgentURL(name, url string)

SetAgentURL sets a URL for a named agent.

type SecureConfig

type SecureConfig struct {
	*Config
	// contains filtered or unexported fields
}

SecureConfig wraps Config with VaultGuard for secure credential access.

func LoadSecureConfig

func LoadSecureConfig(ctx context.Context, opts ...SecureConfigOption) (*SecureConfig, error)

LoadSecureConfig loads configuration with VaultGuard security checks. It enforces security policies based on the environment (local or cloud).

func (*SecureConfig) Close

func (sc *SecureConfig) Close() error

Close cleans up resources.

func (*SecureConfig) Environment

func (sc *SecureConfig) Environment() vaultguard.Environment

Environment returns the detected deployment environment.

func (*SecureConfig) GetCredential

func (sc *SecureConfig) GetCredential(ctx context.Context, name string) (string, error)

GetCredential retrieves a credential from the secure vault.

func (*SecureConfig) GetRequiredCredentials

func (sc *SecureConfig) GetRequiredCredentials(ctx context.Context, names ...string) (map[string]string, error)

GetRequiredCredentials retrieves multiple credentials, failing if any are missing.

func (*SecureConfig) SecurityResult

func (sc *SecureConfig) SecurityResult() *vaultguard.SecurityResult

SecurityResult returns the security assessment result.

type SecureConfigOption

type SecureConfigOption func(*secureConfigOptions)

SecureConfigOption configures secure config loading.

func WithDevPolicy

func WithDevPolicy() SecureConfigOption

WithDevPolicy uses a permissive development policy.

func WithPolicy

func WithPolicy(policy *vaultguard.Policy) SecureConfigOption

WithPolicy sets a custom security policy.

func WithStrictPolicy

func WithStrictPolicy() SecureConfigOption

WithStrictPolicy uses a strict security policy.

Jump to

Keyboard shortcuts

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