config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(cfg *Config) error

Types

type Config

type Config struct {
	// CurrentProfile is the name of the active profile
	CurrentProfile string `json:"current_profile,omitempty"`
	// Profiles maps profile names to their configuration
	Profiles map[string]*Profile `json:"profiles,omitempty"`

	// Legacy fields for backward compatibility
	Token         string `json:"token,omitempty"`
	WorkspaceName string `json:"workspace_name,omitempty"`
	WorkspaceID   string `json:"workspace_id,omitempty"`
	BotID         string `json:"bot_id,omitempty"`
}

Config holds the CLI configuration with support for multiple profiles.

func Load

func Load() (*Config, error)

func (*Config) GetCurrentProfile

func (c *Config) GetCurrentProfile() *Profile

GetCurrentProfile returns the current profile configuration. It handles migration from legacy single-token format.

func (*Config) GetProfile

func (c *Config) GetProfile(name string) *Profile

GetProfile returns a specific profile by name, or nil if not found.

func (*Config) ListProfiles

func (c *Config) ListProfiles() []string

ListProfiles returns a sorted list of profile names.

func (*Config) MigrateToProfiles

func (c *Config) MigrateToProfiles()

MigrateToProfiles migrates legacy single-token config to profiles format.

func (*Config) SetProfile

func (c *Config) SetProfile(name string, profile *Profile)

SetProfile sets or updates a profile in the config.

type Profile

type Profile struct {
	Token         string `json:"token"`
	WorkspaceName string `json:"workspace_name,omitempty"`
	WorkspaceID   string `json:"workspace_id,omitempty"`
	BotID         string `json:"bot_id,omitempty"`
}

Profile represents a single workspace authentication profile.

Jump to

Keyboard shortcuts

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