config

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config manages user-level configuration for the FTL CLI

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// CurrentOrg is the currently selected organization
	CurrentOrg string `json:"current_org,omitempty"`

	// DefaultEnvironment is the default deployment environment
	DefaultEnvironment string `json:"default_environment,omitempty"`

	// Organizations stores metadata about known organizations
	Organizations map[string]OrgInfo `json:"organizations,omitempty"`

	// Preferences stores user preferences
	Preferences Preferences `json:"preferences,omitempty"`

	// LastUpdateCheck tracks when we last checked for updates
	LastUpdateCheck string `json:"last_update_check,omitempty"`

	// CurrentUser stores info about the logged-in user
	CurrentUser *UserInfo `json:"current_user,omitempty"`

	// Version of the config schema
	Version string `json:"version"`
}

Config represents the user's FTL CLI configuration

func Load

func Load() (*Config, error)

Load loads the configuration from disk or creates a new one

func (*Config) AddOrganization

func (c *Config) AddOrganization(info OrgInfo) error

AddOrganization adds or updates organization info

func (*Config) ClearCurrentUser

func (c *Config) ClearCurrentUser() error

ClearCurrentUser removes the current user info

func (*Config) GetCurrentOrg

func (c *Config) GetCurrentOrg() string

GetCurrentOrg returns the currently selected organization

func (*Config) GetCurrentUser

func (c *Config) GetCurrentUser() *UserInfo

GetCurrentUser returns the current user info

func (*Config) GetDefaultEnvironment

func (c *Config) GetDefaultEnvironment() string

GetDefaultEnvironment returns the default environment for deployments

func (*Config) GetOrganization

func (c *Config) GetOrganization(orgID string) (OrgInfo, bool)

GetOrganization retrieves organization info

func (*Config) ListOrganizations

func (c *Config) ListOrganizations() []OrgInfo

ListOrganizations returns all known organizations

func (*Config) Reset

func (c *Config) Reset() error

Reset resets the configuration to defaults

func (*Config) Save

func (c *Config) Save() error

Save saves the configuration to disk

func (*Config) SetCurrentOrg

func (c *Config) SetCurrentOrg(orgID string) error

SetCurrentOrg sets the currently selected organization

func (*Config) SetCurrentUser

func (c *Config) SetCurrentUser(user *UserInfo) error

SetCurrentUser updates the current user info

func (*Config) SetDefaultEnvironment

func (c *Config) SetDefaultEnvironment(env string) error

SetDefaultEnvironment sets the default environment

type OrgInfo

type OrgInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name,omitempty"`
	LastUsed    string `json:"last_used,omitempty"`
	IsDefault   bool   `json:"is_default,omitempty"`
	Environment string `json:"environment,omitempty"` // Default env for this org
}

OrgInfo stores information about an organization

type Preferences

type Preferences struct {
	// ColorOutput controls whether to use colored output
	ColorOutput bool `json:"color_output"`

	// Verbose controls verbose output
	Verbose bool `json:"verbose"`

	// AutoUpdate controls automatic update checks
	AutoUpdate bool `json:"auto_update"`

	// ConfirmDeploy controls whether to confirm before deploying
	ConfirmDeploy bool `json:"confirm_deploy"`
}

Preferences stores user preferences

type UserInfo

type UserInfo struct {
	Username  string `json:"username,omitempty"`
	Email     string `json:"email,omitempty"`
	UserID    string `json:"user_id,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

UserInfo stores information about the authenticated user

Jump to

Keyboard shortcuts

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