config

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config is responsible for loading the configuration and managing it on disk. As a general rule whenever we're reading values we should be working with the runtimeConfig instance. Outside, in the main package, we should be using viper to override certain variables for the runtimeConfig with their corresponding CLI argument or environment variable equivalents. For any mutation methods, we generally should be working with the persisted config. This is too ensure that if the user has for example, overridden the logging level for a single command, we don't persist that log level permanently in the config on disk. This can be a bit finicky in practice, but takes a little care to think here about what can and cannot be overridden at the CLI or ENV levels. If anything changes in here, that cannot be overridden at those levels we should also reflect those changes for the runtimeConfig.

func NewDefaultConfig

func NewDefaultConfig(fs afero.Fs, path string) *Config

func (*Config) AddWorkspace

func (self *Config) AddWorkspace(path string, name string) error

AddWorkspace adds a new workspace to the configuration on disk. In the case of adding a new workspace it should also update the workspaces for the inUse config as it cannot be overridden by any CLI arguments or environment variables.

func (*Config) ClearCurrentWorkspace

func (self *Config) ClearCurrentWorkspace() error

ClearCurrentWorkspace deselects any workspace on a global level.

func (*Config) GetAllProjectMeta

func (self *Config) GetAllProjectMeta() []common.ProjectMeta

func (*Config) GetAllWorkspaceMeta

func (self *Config) GetAllWorkspaceMeta() []common.WorkspaceMeta

GetWorkspaceLocations returns a tuple with the name and path for each workspace.

func (*Config) GetCurrentWorkspace

func (self *Config) GetCurrentWorkspace() string

TODO: add a test

func (*Config) GetLoggingFormat

func (self *Config) GetLoggingFormat() string

func (*Config) GetLoggingLevel

func (self *Config) GetLoggingLevel() string

func (*Config) GetProjectMeta

func (self *Config) GetProjectMeta(wsName string, projectName string) (common.ProjectMeta, error)

func (*Config) GetRuntimeConfig

func (self *Config) GetRuntimeConfig() *config

func (*Config) GetWorkspaceMeta

func (self *Config) GetWorkspaceMeta(name string) (common.WorkspaceMeta, error)

GetWorkspaceLocation returns a tuple with name and path for the given namespace if it does in fact exist. If it doesn't exist an error is returned.

func (*Config) LoadOrCreate

func (self *Config) LoadOrCreate() error

func (*Config) ProjectExists

func (self *Config) ProjectExists(wsName string, name string) (bool, error)

func (*Config) SetProjectPath

func (self *Config) SetProjectPath(wsName string, name string, path string) error

func (*Config) SwitchWorkspace

func (self *Config) SwitchWorkspace(workspaceName string) error

SwitchWorkspace changes the current workspace in the configuration on disk. As this can be overridden by the CLI arguments or environment variables, we don't update the inUse configuration.

Jump to

Keyboard shortcuts

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