Documentation
¶
Index ¶
- func DefaultConfigPath() string
- func DeleteProfile(name string, path string) error
- func EffectiveProfileName(pc *ProfileConfig, override string) string
- func IsNoActiveProfileError(err error) bool
- func ProfileNameFromURL(serverURL string) string
- func Save(cfg *Config, path string) error
- func SaveProfile(name string, cfg *Config, path string) error
- func SaveProfiles(pc *ProfileConfig, path string) error
- func SetActiveProfile(name string, path string) error
- type Config
- type MCPConfig
- type ProfileConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
func DeleteProfile ¶
DeleteProfile removes a profile from the config file.
func EffectiveProfileName ¶
func EffectiveProfileName(pc *ProfileConfig, override string) string
EffectiveProfileName resolves which profile name should be displayed or used for commands that mirror Load's profile selection behavior.
func IsNoActiveProfileError ¶
IsNoActiveProfileError reports whether err is the missing-active-profile error.
func ProfileNameFromURL ¶
ProfileNameFromURL derives a profile name from a server URL.
func SaveProfile ¶
SaveProfile writes a named profile to the config file.
func SaveProfiles ¶
func SaveProfiles(pc *ProfileConfig, path string) error
SaveProfiles writes the full profile configuration to disk.
func SetActiveProfile ¶
SetActiveProfile sets the active profile in the config file.
Types ¶
type Config ¶
type Config struct {
Server string `mapstructure:"server" yaml:"server,omitempty"`
APIKey string `mapstructure:"api_key" yaml:"api_key,omitempty"`
Username string `mapstructure:"username" yaml:"username,omitempty"`
Password string `mapstructure:"password" yaml:"password,omitempty"`
AuthMethod string `mapstructure:"auth_method" yaml:"auth_method,omitempty"` // "apikey" or "basic"
DefaultProject string `mapstructure:"default_project" yaml:"default_project,omitempty"`
OutputFormat string `mapstructure:"output_format" yaml:"output_format,omitempty"` // "table", "json", "csv"
NoColor bool `mapstructure:"no_color" yaml:"no_color,omitempty"`
MCP MCPConfig `mapstructure:"mcp" yaml:"mcp,omitempty"`
}
Config holds the CLI configuration for a single profile.
type MCPConfig ¶ added in v2.5.0
type MCPConfig struct {
// EnableWrites, when set, becomes the default for `--enable-writes` on
// the MCP server. A nil pointer means "fall back to the flag default".
EnableWrites *bool `mapstructure:"enable_writes" yaml:"enable_writes,omitempty"`
// EnableGroups restricts the server to the listed tool groups.
EnableGroups []string `mapstructure:"enable_groups" yaml:"enable_groups,omitempty"`
// DisableGroups removes groups from the active set.
DisableGroups []string `mapstructure:"disable_groups" yaml:"disable_groups,omitempty"`
// EnableTools is an explicit allow-list of tool names.
EnableTools []string `mapstructure:"enable_tools" yaml:"enable_tools,omitempty"`
// DisableTools is a deny-list of tool names applied last.
DisableTools []string `mapstructure:"disable_tools" yaml:"disable_tools,omitempty"`
// AuthToken, when non-empty, becomes the default for `--auth-token` on
// the MCP HTTP transport. Bearer tokens supplied here are used as the
// shared secret clients must present in the Authorization header.
AuthToken string `mapstructure:"auth_token" yaml:"auth_token,omitempty"`
}
MCPConfig holds per-profile defaults for the `redmine mcp serve` command. Empty slices and a nil EnableWrites mean "no preference"; the CLI flags and environment variables take precedence over these values.
type ProfileConfig ¶
type ProfileConfig struct {
ActiveProfile string `yaml:"active_profile,omitempty"`
Profiles map[string]Config `yaml:"profiles,omitempty"`
}
ProfileConfig holds the top-level configuration with multiple profiles.
func LoadProfiles ¶
func LoadProfiles(configPath string, log *debug.Logger) (*ProfileConfig, error)
LoadProfiles reads the full profile configuration from disk. It handles both legacy flat format and new profile format. If the config file does not exist, it returns an empty ProfileConfig.