Documentation
¶
Index ¶
- func ActiveOrgID(env string) domain.OrganizationID
- func ConfigPath(env string, orgID domain.OrganizationID) (string, error)
- func Migrate(env string)
- func OrgPreferencesPath(env string, orgID domain.OrganizationID) (string, error)
- func SetActiveOrgID(env string, orgID domain.OrganizationID) error
- func UserPreferencesPath(env string) (string, error)
- type CLIConfig
- type Config
- func (c *Config) BaseDir() (string, error)
- func (c *Config) Clear() error
- func (c *Config) Get(key string) string
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetList(key string) []string
- func (c *Config) Save() error
- func (c *Config) Set(key string, value string)
- func (c *Config) SetBool(key string, value bool)
- func (c *Config) SetList(key string, values []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveOrgID ¶
func ActiveOrgID(env string) domain.OrganizationID
ActiveOrgID reads the active org ID from env-level user preferences. Returns "" if no active org is set (first run or after reset).
func ConfigPath ¶
func ConfigPath(env string, orgID domain.OrganizationID) (string, error)
ConfigPath returns the config file path for the given env and orgID.
func Migrate ¶ added in v1.11.0
func Migrate(env string)
Migrate brings any prior disk layout to the target layout. Idempotent.
func OrgPreferencesPath ¶ added in v1.11.0
func OrgPreferencesPath(env string, orgID domain.OrganizationID) (string, error)
OrgPreferencesPath returns the org-level preferences path.
func SetActiveOrgID ¶
func SetActiveOrgID(env string, orgID domain.OrganizationID) error
SetActiveOrgID writes the active org ID to env-level user preferences.
func UserPreferencesPath ¶ added in v1.11.0
UserPreferencesPath returns the env-level user preferences path.
Types ¶
type CLIConfig ¶
type CLIConfig struct {
// APIEndpoint is the Tero control plane GraphQL endpoint
APIEndpoint string
// PowerSyncEndpoint is the PowerSync service endpoint for local-first sync
PowerSyncEndpoint string
// ChatEndpoint is the Chat API endpoint for message streaming
ChatEndpoint string
// WorkOSClientID is the WorkOS OAuth client ID for authentication
WorkOSClientID string
// Debug enables debug logging
Debug bool
}
CLIConfig holds configuration for the Tero CLI.
func LoadCLIConfig ¶
func LoadCLIConfig() *CLIConfig
LoadCLIConfig loads CLI configuration from environment variables and defaults.
func (*CLIConfig) Environment ¶
Environment returns the environment name for data isolation. Resolution order:
- TERO_ENV env var (explicit: "local", "dev", "prd", or any custom value)
- Production API endpoint → "prd"
- Non-production → derive from URL host (fallback for custom setups)
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a YAML-backed key-value store. It implements the preferences.Store interface using a map-based structure.
func Load ¶
func Load(env string, orgID domain.OrganizationID) (*Config, error)
Load reads an org-scoped config from disk, migrating from old layouts if needed.
func LoadOrgPreferences ¶ added in v1.11.0
func LoadOrgPreferences(env string, orgID domain.OrganizationID) (*Config, error)
LoadOrgPreferences reads org-scoped preferences from disk.
func LoadUserPreferences ¶ added in v1.11.0
LoadUserPreferences reads the env-level user preferences from disk.