config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OverrideWithEnvVars

func OverrideWithEnvVars(config *Config)

OverrideWithEnvVars overrides configuration with environment variables

Types

type AIConfig

type AIConfig struct {
	Provider   string            `json:"provider"`      // "mock", "openai", "anthropic", "gemini", "ollama", "openrouter"
	APIKey     string            `json:"apiKey"`        // General API key (overridden by provider-specific)
	Model      string            `json:"model"`         // General model (overridden by provider-specific)
	URL        string            `json:"url,omitempty"` // General URL (overridden by provider-specific)
	OpenAI     *AIProviderConfig `json:"openai,omitempty"`
	Anthropic  *AIProviderConfig `json:"anthropic,omitempty"`
	Gemini     *AIProviderConfig `json:"gemini,omitempty"`
	Ollama     *AIProviderConfig `json:"ollama,omitempty"`
	OpenRouter *AIProviderConfig `json:"openrouter,omitempty"`
}

AIConfig holds AI provider configuration

type AIProviderConfig

type AIProviderConfig struct {
	APIKey string `json:"apiKey"`
	Model  string `json:"model"`
	URL    string `json:"url,omitempty"` // For local providers like Ollama
}

AIProviderConfig holds provider-specific configuration

type AuthProvider

type AuthProvider struct {
	Module    string `json:"module,omitempty"`    // e.g., "cassandra.auth"
	ClassName string `json:"className,omitempty"` // e.g., "PlainTextAuthProvider"
}

AuthProvider holds authentication provider configuration

type Config

type Config struct {
	Host                string        `json:"host"`
	Port                int           `json:"port"`
	Keyspace            string        `json:"keyspace"`
	Username            string        `json:"username"`
	Password            string        `json:"password"`
	RequireConfirmation bool          `json:"requireConfirmation,omitempty"`
	Consistency         string        `json:"consistency,omitempty"` // Default consistency level (e.g., "LOCAL_ONE", "QUORUM")
	PageSize            int           `json:"pageSize,omitempty"`
	MaxMemoryMB         int           `json:"maxMemoryMB,omitempty"`    // Max memory for results in MB (default: 10)
	ConnectTimeout      int           `json:"connectTimeout,omitempty"` // Connection timeout in seconds
	RequestTimeout      int           `json:"requestTimeout,omitempty"` // Request timeout in seconds
	Debug               bool          `json:"debug,omitempty"`          // Enable debug logging
	HistoryFile         string        `json:"historyFile,omitempty"`    // Path to CQL command history file
	AIHistoryFile       string        `json:"aiHistoryFile,omitempty"`  // Path to AI command history file
	SSL                 *SSLConfig    `json:"ssl,omitempty"`
	AI                  *AIConfig     `json:"ai,omitempty"`
	AuthProvider        *AuthProvider `json:"authProvider,omitempty"`
}

Config holds the application configuration

func LoadConfig

func LoadConfig(customConfigPath ...string) (*Config, error)

LoadConfig loads configuration from file and environment variables If customConfigPath is provided and not empty, it will be used instead of default locations

type OutputFormat

type OutputFormat string

OutputFormat represents the output format for query results

const (
	OutputFormatTable  OutputFormat = "TABLE"
	OutputFormatASCII  OutputFormat = "ASCII"
	OutputFormatExpand OutputFormat = "EXPAND"
	OutputFormatJSON   OutputFormat = "JSON"
)

func ParseOutputFormat

func ParseOutputFormat(format string) (OutputFormat, error)

ParseOutputFormat converts a string to OutputFormat

type SSLConfig

type SSLConfig struct {
	Enabled            bool   `json:"enabled"`
	CertPath           string `json:"certPath,omitempty"`           // Path to client certificate
	KeyPath            string `json:"keyPath,omitempty"`            // Path to client private key
	CAPath             string `json:"caPath,omitempty"`             // Path to CA certificate
	HostVerification   bool   `json:"hostVerification,omitempty"`   // Enable hostname verification
	InsecureSkipVerify bool   `json:"insecureSkipVerify,omitempty"` // Skip certificate verification (not recommended for production)
	AllowLegacyCN      bool   `json:"allowLegacyCN,omitempty"`      // Allow legacy Common Name field (certificates without SANs)
}

SSLConfig holds SSL/TLS configuration options

Jump to

Keyboard shortcuts

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