config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvAIEnabled         = "FLATT_AI_ENABLED"
	EnvAISelection       = "FLATT_AI_SELECTION"
	EnvOpenAIAPIKey      = "OPENAI_API_KEY"
	EnvOpenRouterAPIKey  = "OPENROUTER_API_KEY"
	EnvOpenAIBaseURL     = "FLATT_OPENAI_BASE_URL"
	EnvOpenRouterBaseURL = "FLATT_OPENROUTER_BASE_URL"
	EnvOllamaBaseURL     = "FLATT_OLLAMA_BASE_URL"
)

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

func MaskKey

func MaskKey(value string) string

func ReadEnvFile

func ReadEnvFile(path string) (map[string]string, error)

func Save

func Save(path string, cfg Config) error

func WriteEnvFileAtomic

func WriteEnvFileAtomic(path string, values map[string]string) error

Types

type AISelection

type AISelection struct {
	Provider string
	Model    string
}

func ParseAISelection

func ParseAISelection(value string) (AISelection, error)

type Config

type Config struct {
	AIEnabled         bool
	AISelection       string
	OpenAIAPIKey      string
	OpenRouterAPIKey  string
	OpenAIBaseURL     string
	OpenRouterBaseURL string
	OllamaBaseURL     string
	Values            map[string]string
}

func DefaultConfig

func DefaultConfig() Config

func Load

func Load(path string) (Config, error)

func (Config) APIKeyForProvider

func (c Config) APIKeyForProvider(provider string) string

func (Config) Selection

func (c Config) Selection() (AISelection, error)

Jump to

Keyboard shortcuts

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