Documentation
¶
Index ¶
- Constants
- func ConfigDir() (string, error)
- func ConfigFilePath() (string, error)
- func CredentialsFilePath() (string, error)
- func CurrentProfile() (string, error)
- func DeleteCredentialKeys(profile string, keys ...string) error
- func ListProfiles() (profiles []string, current string, err error)
- func LoadConfigProfile(profile string) (map[string]string, error)
- func LoadCredentials(profile string) (map[string]string, error)
- func ResetConfigFile()
- func SaveConfigProfile(profile string, cfg map[string]string) error
- func SaveCredentials(profile string, creds map[string]string) error
- func SetConfigFile(path string)
- func SetCurrentProfile(profile string) error
- func ValidateProfileName(name string) error
- type ProfileConfig
Constants ¶
const DefaultProfile = "prod"
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
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 ¶
ConfigFilePath returns the full path to config.toml. If SetConfigFile was called, returns that path instead.
func CredentialsFilePath ¶
CredentialsFilePath returns the full path to credentials.toml.
func CurrentProfile ¶ added in v0.4.1
CurrentProfile reads the current_profile from config.toml. Returns DefaultProfile if not set.
func DeleteCredentialKeys ¶ added in v0.4.1
DeleteCredentialKeys removes the given keys from a profile in credentials.toml.
func ListProfiles ¶ added in v0.4.1
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
LoadConfigProfile reads key-value pairs for the given profile from config.toml.
func LoadCredentials ¶
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
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 ¶
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
SetCurrentProfile writes the current_profile to config.toml.
func ValidateProfileName ¶ added in v0.4.1
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"