-
Notifications
You must be signed in to change notification settings - Fork 329
Add azd config options command for config discoverability
#6390
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ca584ee
Initial plan
Copilot 672a794
Add azd config options command to list all available config settings
Copilot f4aaa3a
Add tests and snapshot updates for config options command
Copilot 734ae36
Fix log.Panic error formatting as per code review feedback
Copilot f20cebb
Add environment variable information to config options output
Copilot 6accc32
Add Current Value column to config options table output
Copilot cf82fd0
Address code review feedback and fix figspec snapshot test
Copilot 2baf73e
Add help examples for azd config options command
Copilot 9766066
Change default output format to readable list format
Copilot 444dbef
Add integration tests for config options action
Copilot d049097
Fix gofmt formatting in config_options_test.go
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
|
|
||
| List all available configuration settings. | ||
|
|
||
| Usage | ||
| azd config options [flags] | ||
|
|
||
| Global Flags | ||
| -C, --cwd string : Sets the current working directory. | ||
| --debug : Enables debugging and diagnostics logging. | ||
| --docs : Opens the documentation for azd config options in your web browser. | ||
| -h, --help : Gets help for options. | ||
| --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. | ||
|
|
||
| Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package config | ||
|
|
||
| import ( | ||
| "log" | ||
|
|
||
| "github.com/azure/azure-dev/cli/azd/resources" | ||
| "github.com/braydonk/yaml" | ||
| ) | ||
|
|
||
| // ConfigOption defines a configuration setting that can be set in azd config | ||
| type ConfigOption struct { | ||
| Key string `yaml:"key"` | ||
| Description string `yaml:"description"` | ||
| Type string `yaml:"type"` | ||
| AllowedValues []string `yaml:"allowedValues,omitempty"` | ||
| Example string `yaml:"example,omitempty"` | ||
| EnvVar string `yaml:"envVar,omitempty"` | ||
| } | ||
|
|
||
| var allConfigOptions []ConfigOption | ||
|
|
||
| func init() { | ||
| err := yaml.Unmarshal(resources.ConfigOptions, &allConfigOptions) | ||
| if err != nil { | ||
| log.Panicf("Can't unmarshal config options! %v", err) | ||
| } | ||
| } | ||
|
|
||
| // GetAllConfigOptions returns all available configuration options | ||
| func GetAllConfigOptions() []ConfigOption { | ||
| return allConfigOptions | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package config | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestGetAllConfigOptions(t *testing.T) { | ||
| options := GetAllConfigOptions() | ||
|
|
||
| // Should have at least some options | ||
| require.NotEmpty(t, options) | ||
| require.Greater(t, len(options), 0) | ||
|
|
||
| // Check that we have the expected default options | ||
| foundDefaultsSubscription := false | ||
| foundDefaultsLocation := false | ||
| foundAlphaAll := false | ||
|
|
||
| for _, option := range options { | ||
| require.NotEmpty(t, option.Key, "Config option key should not be empty") | ||
| require.NotEmpty(t, option.Description, "Config option description should not be empty") | ||
| require.NotEmpty(t, option.Type, "Config option type should not be empty") | ||
|
|
||
| switch option.Key { | ||
| case "defaults.subscription": | ||
| foundDefaultsSubscription = true | ||
| require.Equal(t, "string", option.Type) | ||
| require.Contains(t, option.Description, "subscription") | ||
| case "defaults.location": | ||
| foundDefaultsLocation = true | ||
| require.Equal(t, "string", option.Type) | ||
| require.Contains(t, option.Description, "location") | ||
| case "alpha.all": | ||
| foundAlphaAll = true | ||
| require.Equal(t, "string", option.Type) | ||
| require.Contains(t, option.AllowedValues, "on") | ||
| require.Contains(t, option.AllowedValues, "off") | ||
| require.Equal(t, "AZD_ALPHA_ENABLE_ALL", option.EnvVar) | ||
| } | ||
| } | ||
|
|
||
| // Verify expected options are present | ||
| require.True(t, foundDefaultsSubscription, "defaults.subscription option should be present") | ||
| require.True(t, foundDefaultsLocation, "defaults.location option should be present") | ||
| require.True(t, foundAlphaAll, "alpha.all option should be present") | ||
| } | ||
|
|
||
| func TestConfigOptionStructure(t *testing.T) { | ||
| options := GetAllConfigOptions() | ||
|
|
||
| for _, option := range options { | ||
| // All options should have required fields | ||
| require.NotEmpty(t, option.Key) | ||
| require.NotEmpty(t, option.Description) | ||
| require.NotEmpty(t, option.Type) | ||
|
|
||
| // If AllowedValues is set, it should not be empty | ||
| if len(option.AllowedValues) > 0 { | ||
| for _, val := range option.AllowedValues { | ||
| require.NotEmpty(t, val, "Allowed value should not be empty") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
spboyer marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| - key: defaults.subscription | ||
| description: "Default Azure subscription ID to use for operations." | ||
| type: string | ||
| example: "00000000-0000-0000-0000-000000000000" | ||
| - key: defaults.location | ||
| description: "Default Azure location/region to use for deployments." | ||
| type: string | ||
| example: "eastus" | ||
| - key: alpha.all | ||
| description: "Enable or disable all alpha features at once." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_ALL" | ||
| - key: alpha.aks.helm | ||
| description: "Enable Helm support for AKS deployments." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_AKS_HELM" | ||
| - key: alpha.aks.kustomize | ||
| description: "Enable Kustomize support for AKS deployments." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_AKS_KUSTOMIZE" | ||
| - key: alpha.aca.persistDomains | ||
|
spboyer marked this conversation as resolved.
|
||
| description: "Do not change custom domains when deploying Azure Container Apps." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_ACA_PERSISTDOMAINS" | ||
| - key: alpha.azd.operations | ||
| description: "Extends provisioning providers with azd operations." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_AZD_OPERATIONS" | ||
| - key: alpha.aca.persistIngressSessionAffinity | ||
| description: "Do not change Ingress Session Affinity when deploying Azure Container Apps." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_ACA_PERSISTINGRESSSESSIONAFFINITY" | ||
| - key: alpha.deployment.stacks | ||
| description: "Enables Azure deployment stacks for ARM/Bicep based deployments." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_DEPLOYMENT_STACKS" | ||
| - key: alpha.llm | ||
| description: "Enables the use of LLMs in the CLI." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_LLM" | ||
| - key: alpha.language.custom | ||
| description: "Enables support for services to use custom language." | ||
| type: string | ||
| allowedValues: ["on", "off"] | ||
| envVar: "AZD_ALPHA_ENABLE_LANGUAGE_CUSTOM" | ||
| - key: template.sources | ||
| description: "Custom template sources for azd template list and azd init." | ||
| type: object | ||
| example: "template.sources.<name>.type" | ||
| - key: pipeline.config.applicationServiceManagementReference | ||
| description: "Application Service Management Reference for Azure pipeline configuration." | ||
| type: string | ||
| - key: (env) AZD_CONFIG_DIR | ||
| description: "Override the default configuration directory location." | ||
| type: envvar | ||
|
spboyer marked this conversation as resolved.
|
||
| example: "/path/to/config" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.