config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProfile = "prod"

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the flowmi configuration directory. It checks $XDG_CONFIG_HOME/flowmi first, falling back to a platform-specific default: ~/.config/flowmi on Unix, %AppData%\flowmi on Windows.

func ConfigFilePath

func ConfigFilePath() (string, error)

ConfigFilePath returns the full path to config.toml. If SetConfigFile was called, returns that path instead.

func CredentialsFilePath

func CredentialsFilePath() (string, error)

CredentialsFilePath returns the full path to credentials.toml.

func CurrentProfile added in v0.4.1

func CurrentProfile() (string, error)

CurrentProfile reads the current_profile from config.toml. Returns DefaultProfile if not set.

func DeleteCredentialKeys added in v0.4.1

func DeleteCredentialKeys(profile string, keys ...string) error

DeleteCredentialKeys removes the given keys from a profile in credentials.toml.

func ListProfiles added in v0.4.1

func ListProfiles() (profiles []string, current string, err error)

ListProfiles returns profile names and the current profile. Unions profile names from both config.toml and credentials.toml.

func LoadConfigProfile added in v0.4.1

func LoadConfigProfile(profile string) (map[string]string, error)

LoadConfigProfile reads key-value pairs for the given profile from config.toml.

func LoadCredentials

func LoadCredentials(profile string) (map[string]string, error)

LoadCredentials reads key-value pairs for the given profile from credentials.toml. Returns an empty map (not an error) if the file or profile does not exist.

func ResetConfigFile added in v0.4.1

func ResetConfigFile()

ResetConfigFile clears the config file override. Tests that call SetConfigFile should defer ResetConfigFile via t.Cleanup to avoid leaking state into other tests.

func SaveConfigProfile added in v0.4.1

func SaveConfigProfile(profile string, cfg map[string]string) error

SaveConfigProfile writes key-value pairs to the given profile section in config.toml, preserving the current_profile top-level key and other profile sections.

func SaveCredentials

func SaveCredentials(profile string, creds map[string]string) error

SaveCredentials writes key-value pairs to the given profile section in credentials.toml.

func SetConfigFile added in v0.4.1

func SetConfigFile(path string)

SetConfigFile overrides the default config.toml path (e.g. from --config flag).

func SetCurrentProfile added in v0.4.1

func SetCurrentProfile(profile string) error

SetCurrentProfile writes the current_profile to config.toml.

func ValidateProfileName added in v0.4.1

func ValidateProfileName(name string) error

ValidateProfileName returns an error if the profile name is empty, reserved, or contains characters that would conflict with TOML structure.

Types

type ProfileConfig added in v0.4.1

type ProfileConfig struct {
	CurrentProfile string                       `toml:"current_profile,omitempty"`
	Profiles       map[string]map[string]string `toml:"-"`
}

ProfileConfig represents the full config.toml with profile sections.

current_profile = "prod"
[prod]
api_server_url = "https://api.flowmi.ai"
auth_server_url = "https://flowmi.ai"
[local]
api_server_url = "http://localhost:8080"
auth_server_url = "http://localhost:5173"

Jump to

Keyboard shortcuts

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