config

package
v0.9.20 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GlobalConfigDirName is the directory name for global config
	GlobalConfigDirName = ".weave-cli"
	// EnvFileName is the name of the environment file
	EnvFileName = ".env"
	// ConfigFileName is the name of the YAML config file
	ConfigFileName = "config.yaml"
)

Variables

This section is empty.

Functions

func GetConfigFile

func GetConfigFile() string

GetConfigFile returns the path to the config file being used

func GetEnvFile

func GetEnvFile() string

GetEnvFile returns the path to the env file being used

func GetGlobalConfigDir added in v0.2.0

func GetGlobalConfigDir() (string, error)

GetGlobalConfigDir returns the path to ~/.weave-cli directory

func InterpolateString

func InterpolateString(s string) string

InterpolateString interpolates environment variables in a string

Types

type Collection

type Collection struct {
	Name        string `yaml:"name"`
	Type        string `yaml:"type"`
	Description string `yaml:"description,omitempty"`
}

Collection represents a collection configuration

type Config

type Config struct {
	Databases  DatabasesConfig `yaml:"databases"`
	SchemasDir string          `yaml:"schemas_dir,omitempty"`
	TLS        TLSConfig       `yaml:"tls,omitempty"`
}

Config holds the complete application configuration

func LoadConfig

func LoadConfig(configFile, envFile string) (*Config, error)

func LoadConfigWithOptions

func LoadConfigWithOptions(opts LoadConfigOptions) (*Config, error)

func (*Config) GetAllSchemas

func (c *Config) GetAllSchemas() []SchemaDefinition

GetAllSchemas returns all configured schema definitions

func (*Config) GetDatabase

func (c *Config) GetDatabase(name string) (*VectorDBConfig, error)

GetDatabase returns a specific vector database configuration by name

func (*Config) GetDatabaseNames

func (c *Config) GetDatabaseNames() map[string]VectorDBType

GetDatabaseNames returns a map of database names to their types

func (*Config) GetDefaultDatabase

func (c *Config) GetDefaultDatabase() (*VectorDBConfig, error)

GetDefaultDatabase returns the default vector database configuration

func (*Config) GetSchema

func (c *Config) GetSchema(name string) (*SchemaDefinition, error)

GetSchema returns a specific schema definition by name

func (*Config) ListDatabases

func (c *Config) ListDatabases() []string

ListDatabases returns a list of all configured database names

func (*Config) ListSchemas

func (c *Config) ListSchemas() []string

ListSchemas returns a list of all configured schema names

type ConfigPaths added in v0.2.0

type ConfigPaths struct {
	EnvPath    string
	ConfigPath string
	Location   string // "local" or "global"
}

ConfigPaths holds the paths to configuration files

func FindConfigPaths added in v0.2.0

func FindConfigPaths() (*ConfigPaths, error)

FindConfigPaths finds configuration files with proper precedence: 1. Local directory (current working directory) 2. Global directory (~/.weave-cli)

type DatabasesConfig

type DatabasesConfig struct {
	Default         string             `yaml:"default"`
	VectorDatabases []VectorDBConfig   `yaml:"vector_databases"`
	Schemas         []SchemaDefinition `yaml:"schemas,omitempty"`
}

DatabasesConfig holds multiple databases configuration

type LoadConfigOptions

type LoadConfigOptions struct {
	ConfigFile     string
	EnvFile        string
	VectorDBType   string
	WeaviateAPIKey string
	WeaviateURL    string
}

LoadConfig loads configuration from files and environment variables LoadConfigOptions holds options for loading configuration

type MockCollection

type MockCollection struct {
	Name        string `yaml:"name"`
	Type        string `yaml:"type"`
	Description string `yaml:"description"`
}

MockCollection represents a mock collection (for backward compatibility)

type MockConfig

type MockConfig struct {
	Enabled            bool             `yaml:"enabled"`
	SimulateEmbeddings bool             `yaml:"simulate_embeddings"`
	EmbeddingDimension int              `yaml:"embedding_dimension"`
	Collections        []MockCollection `yaml:"collections"`
}

MockConfig holds mock database configuration (for backward compatibility)

type SchemaDefinition

type SchemaDefinition struct {
	Name     string                 `yaml:"name"`
	Schema   map[string]interface{} `yaml:"schema"`
	Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}

SchemaDefinition represents a named schema that can be used to create collections

type TLSConfig added in v0.9.3

type TLSConfig struct {
	Enabled      bool   `yaml:"enabled"`
	CertFile     string `yaml:"cert_file,omitempty"`
	KeyFile      string `yaml:"key_file,omitempty"`
	AutoRedirect bool   `yaml:"auto_redirect,omitempty"`
}

TLSConfig holds TLS/HTTPS configuration

type VectorDBConfig

type VectorDBConfig struct {
	Name               string       `yaml:"name"`
	Type               VectorDBType `yaml:"type"`
	URL                string       `yaml:"url,omitempty"`
	APIKey             string       `yaml:"api_key,omitempty"`
	OpenAIAPIKey       string       `yaml:"openai_api_key,omitempty"`
	DatabaseURL        string       `yaml:"database_url,omitempty"` // Supabase: PostgreSQL connection URL
	DatabaseKey        string       `yaml:"database_key,omitempty"` // Supabase: service role key or anon key
	Timeout            int          `yaml:"timeout,omitempty"`      // Connection timeout in seconds
	Enabled            bool         `yaml:"enabled,omitempty"`
	SimulateEmbeddings bool         `yaml:"simulate_embeddings,omitempty"`
	EmbeddingDimension int          `yaml:"embedding_dimension,omitempty"`
	Collections        []Collection `yaml:"collections"`
}

VectorDBConfig holds vector database configuration

type VectorDBType

type VectorDBType string

VectorDBType represents the type of vector database

const (
	VectorDBTypeCloud    VectorDBType = "weaviate-cloud"
	VectorDBTypeLocal    VectorDBType = "weaviate-local"
	VectorDBTypeMock     VectorDBType = "mock"
	VectorDBTypeSupabase VectorDBType = "supabase"
)

Jump to

Keyboard shortcuts

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