Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ const (
DEFAULT = "default"
)

var nonEmptyConfigKeys = map[string]bool{
"output": true,
"timeout": true,
"profile": true,
"url": true,
}

// DefaultACSAPIEndpoint is the default API endpoint for CloudStack.
const DefaultACSAPIEndpoint = "http://localhost:8080/client/api"

Expand Down Expand Up @@ -347,6 +354,10 @@ func (c *Config) LoadProfile(name string) {

// UpdateConfig updates and saves config
func (c *Config) UpdateConfig(key string, value string, update bool) {
if nonEmptyConfigKeys[key] && value == "" {
fmt.Printf("Error: value for '%s' must not be empty\n", key)
return
}
switch key {
case "prompt":
c.Core.Prompt = value
Expand Down