Documentation
¶
Overview ¶
Package config loads ogcode's optional file-based configuration: provider base URLs and API keys, so they can live in a committed/shared file instead of only environment variables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureProjectFile ¶
EnsureProjectFile creates a blank project-local ogcode.json in dir if no ogcode.json is found in dir or any of its ancestors (see findProjectFile). An existing file — found anywhere in that search — is left untouched, and so is dir itself if creation fails for any reason (e.g. a read-only filesystem): this is a best-effort convenience, never a requirement for startup. Returns the path that was created, or "" if nothing was created.
Types ¶
type Config ¶
type Config struct {
Providers map[string]ProviderConfig `json:"providers,omitempty"`
}
Config is ogcode's file-based configuration.
func Load ¶
Load reads the global config (~/.config/ogcode/config.json) and the project-local config (ogcode.json, found by searching dir and its parents, stopping once the repo root — the directory holding .git — has been checked), merging them provider-by-provider with project-local values taking precedence. Missing or unreadable files are silently skipped; Load always returns a usable, non-nil Config.
type ProviderConfig ¶
type ProviderConfig struct {
BaseURL string `json:"baseUrl,omitempty"`
APIKey string `json:"apiKey,omitempty"`
}
ProviderConfig holds per-provider connection overrides.