config

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 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) string

ActiveOrgID reads the active org ID for the given environment. Returns "" if no active org is set (first run or after reset).

func ConfigPath

func ConfigPath(env, orgID string) (string, error)

ConfigPath returns the config file path for the given env and orgID.

func SetActiveOrgID

func SetActiveOrgID(env, orgID string) error

SetActiveOrgID writes the active org ID for the given environment.

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

func (c *CLIConfig) Environment() string

Environment returns the environment name for data isolation. Resolution order:

  1. TERO_ENV env var (explicit: "local", "dev", "prd", or any custom value)
  2. Production API endpoint → "prd"
  3. Non-production → derive from URL host (fallback for custom setups)

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the Tero CLI configuration stored as YAML. It implements the app.Store interface using a map-based structure for flexibility. Each org gets its own config file at ~/.tero/environments/{env}/orgs/{orgID}/config.yaml.

func Load

func Load(env, orgID string) (*Config, error)

Load reads the config from disk, migrating from the old layout if needed.

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