Skip to content
Merged
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion scw/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import (
const (
documentationLink = "https://github.com/scaleway/scaleway-sdk-go/blob/master/scw/README.md"
defaultConfigPermission = 0600

// Reserved name for the default profile.
DefaultProfileName = "default"
)

const configFileTemplate = `# Scaleway configuration file
Expand Down Expand Up @@ -217,7 +220,11 @@ func LoadConfigFromPath(path string) (*Config, error) {
// GetProfile returns the profile corresponding to the given profile name.
func (c *Config) GetProfile(profileName string) (*Profile, error) {
if profileName == "" {
return nil, errors.New("active profile cannot be empty")
return nil, errors.New("profileName cannot be empty")
}

if profileName == DefaultProfileName {
return &c.Profile, nil
}

p, exist := c.Profiles[profileName]
Expand Down