Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFavorite ¶
AddFavorite adds a named favorite to the config. Returns an error if the name already exists. Defaults provider to "azure" if empty.
func ConfigPath ¶
ConfigPath returns the config file path, respecting the GRANT_CONFIG env var.
func RemoveFavorite ¶
RemoveFavorite removes a named favorite. Returns an error if not found.
Types ¶
type Config ¶
type Config struct {
Profile string `yaml:"profile"`
DefaultProvider string `yaml:"default_provider"`
Favorites map[string]Favorite `yaml:"favorites"`
}
Config holds the grant application configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with default values.
func Load ¶
Load reads a config file from the given path. If the file does not exist, it returns the default config.
func LoadDefaultWithPath ¶ added in v0.2.0
LoadDefaultWithPath resolves the config path via ConfigPath() and loads the config. Returns the config, the resolved path, and any error.
type Favorite ¶
type Favorite struct {
Provider string `yaml:"provider"`
Target string `yaml:"target"`
Role string `yaml:"role"`
}
Favorite represents a saved elevation target.
type FavoriteEntry ¶
FavoriteEntry pairs a favorite name with its data, used for sorted listing.
func ListFavorites ¶
func ListFavorites(cfg *Config) []FavoriteEntry
ListFavorites returns all favorites sorted alphabetically by name.