config

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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

func UserPreferencesPath(env string) (string, error)

UserPreferencesPath returns the env-level user preferences path.

Types

type CLIConfig

type CLIConfig struct {
	// Env is the environment name (local, dev, prd) from TERO_ENV.
	Env string

	// 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. Resolution: TERO_ENV selects per-environment defaults, then individual env vars override.

func (*CLIConfig) Environment

func (c *CLIConfig) Environment() string

Environment returns the environment name for data isolation.

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

func LoadUserPreferences(env string) (*Config, error)

LoadUserPreferences reads the env-level user preferences from disk.

func (*Config) BaseDir

func (c *Config) BaseDir() (string, error)

BaseDir returns the base directory for all Tero data.

func (*Config) Clear

func (c *Config) Clear() error

Clear removes the config file from disk.

func (*Config) Get

func (c *Config) Get(key string) string

Get retrieves a string value by key

func (*Config) GetBool

func (c *Config) GetBool(key string) bool

GetBool retrieves a boolean value by key

func (*Config) GetList

func (c *Config) GetList(key string) []string

GetList retrieves a list of strings by key

func (*Config) Save

func (c *Config) Save() error

Save writes the config to disk.

func (*Config) Set

func (c *Config) Set(key string, value string)

Set stores a string value by key

func (*Config) SetBool

func (c *Config) SetBool(key string, value bool)

SetBool stores a boolean value by key

func (*Config) SetList

func (c *Config) SetList(key string, values []string)

SetList stores a list of strings by key

Jump to

Keyboard shortcuts

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