Documentation
¶
Index ¶
- Variables
- func DebugLog(format string, args ...interface{})
- func DecryptConfig(data []byte, password string) ([]byte, error)
- func EncryptConfig(path string, password string) error
- func GenerateBearerToken() (string, error)
- func GetEnvPath() string
- func IsEncrypted(data []byte) bool
- func PromptPassword(prompt string) (string, error)
- func SaveEnvConfig(path string, config *EnvConfig) error
- func ValidateModelMode(mode ModelMode) bool
- func VerboseLog(format string, args ...interface{})
- type CORS
- type DatabaseConfig
- type DatabaseType
- type EnvConfig
- func (c *EnvConfig) AddDatabase(name string, config DatabaseConfig)
- func (c *EnvConfig) AddModelToProvider(providerName string, model Model) error
- func (c *EnvConfig) AddProvider(name string, provider Provider)
- func (c *EnvConfig) GetDatabaseConfig(name string) (*DatabaseConfig, error)
- func (c *EnvConfig) GetModelConfig(providerName, modelName string) (*Model, error)
- func (c *EnvConfig) GetProviderConfig(providerName string) (*Provider, error)
- func (c *EnvConfig) GetServerConfig() *ServerConfig
- func (c *EnvConfig) UpdateAPIKey(providerName, apiKey string) error
- func (c *EnvConfig) UpdateModelModes(providerName, modelName string, modes []ModelMode) error
- func (c *EnvConfig) UpdateServerConfig(serverConfig ServerConfig)
- type Model
- type ModelMode
- type Provider
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
var Debug bool
Debug indicates whether debug logging is enabled
var Verbose bool
Verbose indicates whether verbose logging is enabled
Functions ¶
func DebugLog ¶
func DebugLog(format string, args ...interface{})
DebugLog prints debug information if debug mode is enabled
func DecryptConfig ¶
DecryptConfig decrypts the configuration data
func EncryptConfig ¶
EncryptConfig encrypts the configuration file
func GenerateBearerToken ¶
GenerateBearerToken generates a secure random bearer token
func GetEnvPath ¶
func GetEnvPath() string
GetEnvPath returns the environment file path from COMANDA_ENV or the default
func IsEncrypted ¶
IsEncrypted checks if the file content is encrypted
func PromptPassword ¶
PromptPassword prompts the user for a password securely
func SaveEnvConfig ¶
SaveEnvConfig saves the environment configuration to .env file
func ValidateModelMode ¶
ValidateModelMode checks if a mode is valid
func VerboseLog ¶
func VerboseLog(format string, args ...interface{})
VerboseLog prints verbose information if verbose mode is enabled
Types ¶
type CORS ¶ added in v0.0.16
type CORS struct {
Enabled bool `yaml:"enabled"`
AllowedOrigins []string `yaml:"allowedOrigins"`
AllowedMethods []string `yaml:"allowedMethods"`
AllowedHeaders []string `yaml:"allowedHeaders"`
MaxAge int `yaml:"maxAge"`
}
CORS holds Cross-Origin Resource Sharing settings
type DatabaseConfig ¶
type DatabaseConfig struct {
Type DatabaseType `yaml:"type"`
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
Database string `yaml:"database"`
}
DatabaseConfig represents a database connection configuration
func (*DatabaseConfig) GetConnectionString ¶
func (c *DatabaseConfig) GetConnectionString() string
GetConnectionString returns a connection string for the specified database
type DatabaseType ¶
type DatabaseType string
DatabaseType represents supported database types
const (
PostgreSQL DatabaseType = "postgres"
)
type EnvConfig ¶
type EnvConfig struct {
Providers map[string]*Provider `yaml:"providers"` // Changed to store pointers to Provider
Server *ServerConfig `yaml:"server,omitempty"`
Databases map[string]DatabaseConfig `yaml:"databases,omitempty"` // Added database configurations
}
EnvConfig represents the complete environment configuration
func LoadEncryptedEnvConfig ¶
LoadEncryptedEnvConfig loads an encrypted environment configuration
func LoadEnvConfig ¶
LoadEnvConfig loads the environment configuration from .env file
func LoadEnvConfigWithPassword ¶
LoadEnvConfigWithPassword attempts to load the config, prompting for password if encrypted
func (*EnvConfig) AddDatabase ¶
func (c *EnvConfig) AddDatabase(name string, config DatabaseConfig)
AddDatabase adds or updates a database configuration
func (*EnvConfig) AddModelToProvider ¶
AddModelToProvider adds a model to a specific provider
func (*EnvConfig) AddProvider ¶
AddProvider adds or updates a provider configuration
func (*EnvConfig) GetDatabaseConfig ¶
func (c *EnvConfig) GetDatabaseConfig(name string) (*DatabaseConfig, error)
GetDatabaseConfig retrieves configuration for a specific database
func (*EnvConfig) GetModelConfig ¶
GetModelConfig retrieves configuration for a specific model
func (*EnvConfig) GetProviderConfig ¶
GetProviderConfig retrieves configuration for a specific provider
func (*EnvConfig) GetServerConfig ¶
func (c *EnvConfig) GetServerConfig() *ServerConfig
GetServerConfig retrieves the server configuration
func (*EnvConfig) UpdateAPIKey ¶
UpdateAPIKey updates the API key for a specific provider
func (*EnvConfig) UpdateModelModes ¶
UpdateModelModes updates the modes for a specific model
func (*EnvConfig) UpdateServerConfig ¶
func (c *EnvConfig) UpdateServerConfig(serverConfig ServerConfig)
UpdateServerConfig updates the server configuration
type Model ¶
type Model struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Modes []ModelMode `yaml:"modes"`
}
Model represents a single model configuration
type ModelMode ¶
type ModelMode string
ModelMode represents the supported modes for a model
func GetSupportedModes ¶
func GetSupportedModes() []ModelMode
GetSupportedModes returns all supported model modes
type ServerConfig ¶
type ServerConfig struct {
Port int `yaml:"port"`
DataDir string `yaml:"dataDir"`
RuntimeDir string `yaml:"runtimeDir"` // Directory for runtime files like uploads and YAML processing
Enabled bool `yaml:"enabled"`
BearerToken string `yaml:"bearerToken"`
CORS CORS `yaml:"cors"`
}
ServerConfig holds configuration for the HTTP server