Documentation
¶
Overview ¶
Package config loads and persists the CLI configuration in ~/.volcano/config.json.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotAuthenticated indicates no token is configured for cloud API calls. ErrNotAuthenticated = errors.New("not authenticated. Run 'volcano login' first") // ErrNoProjectSelected indicates no active project is configured for project-scoped cloud API calls. ErrNoProjectSelected = errors.New("no project selected. Run 'volcano use <project-name>' or set VOLCANO_PROJECT_ID") )
Functions ¶
func Delete ¶
func Delete() error
Delete removes ~/.volcano/config.json. A missing file is considered success.
func FirstPartyDeviceClientID ¶
FirstPartyDeviceClientID resolves the first-party OAuth device client ID.
Types ¶
type Config ¶
type Config struct {
// APIBaseURL overrides the compiled API URL for synthetic command configs.
// It is intentionally not persisted to the user's cloud config file.
APIBaseURL string `json:"-"`
UserToken string `json:"user_token,omitempty"`
UserID string `json:"user_id,omitempty"`
CurrentProject *ProjectConfig `json:"current_project,omitempty"`
// IgnoreEnv disables environment overrides for synthetic command configs.
IgnoreEnv bool `json:"-"`
}
Config represents the CLI configuration stored in ~/.volcano/config.json.
func (*Config) APIURL ¶
APIURL returns the API URL with VOLCANO_API_URL taking precedence unless env overrides are disabled. Precedence: env > runtime override (APIBaseURL) > compiled default.
func (*Config) ProjectID ¶
ProjectID returns the current project ID, with VOLCANO_PROJECT_ID taking precedence unless env overrides are disabled.
func (*Config) RequireAuth ¶
RequireAuth returns an old-CLI-compatible error when no token is available.
func (*Config) RequireProject ¶
RequireProject returns an old-CLI-compatible error when no project is selected.
type ProjectConfig ¶
ProjectConfig represents the currently selected Volcano project.