Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configurable api-version for container app deployments #4272

Merged
merged 10 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions cli/azd/.vscode/cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ words:
- azcloud
- usgovcloudapi
- chinacloudapi
- unmarshals
languageSettings:
- languageId: go
ignoreRegExpList:
Expand Down
33 changes: 33 additions & 0 deletions cli/azd/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@ type Config interface {
Raw() map[string]any
// similar to Raw() but it will resolve any vault references
ResolvedRaw() map[string]any
// Get retrieves the value stored at the specified path
Get(path string) (any, bool)
// GetString retrieves the value stored at the specified path as a string
GetString(path string) (string, bool)
// GetSection retrieves the value stored at the specified path and unmarshals it into the provided section
GetSection(path string, section any) (bool, error)
// GetMap retrieves the map stored at the specified path
GetMap(path string) (map[string]any, bool)
// GetSlice retrieves the slice stored at the specified path
GetSlice(path string) ([]any, bool)
// Set stores the value at the specified path
Set(path string, value any) error
// SetSecret stores the secrets at the specified path within a local user vault
SetSecret(path string, value string) error
// Unset removes the value stored at the specified path
Unset(path string) error
// IsEmpty returns a value indicating whether the configuration is empty
IsEmpty() bool
}

Expand Down Expand Up @@ -230,6 +241,28 @@ func (c *config) Get(path string) (any, bool) {
return nil, false
}

// GetMap retrieves the map stored at the specified path
func (c *config) GetMap(path string) (map[string]any, bool) {
value, ok := c.Get(path)
if !ok {
return nil, false
}

node, ok := value.(map[string]any)
return node, ok
}

// GetSlice retrieves the slice stored at the specified path
func (c *config) GetSlice(path string) ([]any, bool) {
value, ok := c.Get(path)
if !ok {
return nil, false
}

node, ok := value.([]any)
return node, ok
}

// Gets the value stored at the specified location as a string
func (c *config) GetString(path string) (string, bool) {
value, ok := c.Get(path)
Expand Down
Loading
Loading