Skip to content

Commit

Permalink
Update environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine WANJAU committed Jan 27, 2025
1 parent ac6f490 commit 596662e
Show file tree
Hide file tree
Showing 27 changed files with 58,550 additions and 56,977 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def serialize(obj):
# State property doesn't make sense in feature flag version 2 schema beacuse of the added properties - variants, allocation, telemetry
# The State property only exists in the CLI, we should move to showing enabled property instead as the other clients
# As we move to showing the enabled property, we will show the state property in the CLI only if compatibility mode is true
env_compatibility_mode = os.environ.get("AZURE_APPCONFIG_FM_COMPATIBLE", True)
env_compatibility_mode = os.environ.get("AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE", True)
compatibility_mode = str(env_compatibility_mode).lower() == "true"

feature = map_keyvalue_to_featureflag(obj, hide_enabled=compatibility_mode)
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/appconfig/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
type: command
short-summary: Export configurations to another place from your App Configuration store.
examples:
- name: Export all keys and feature flags with label test to a json file. To use the microsoft feature management schema when exporting feature flags to a file, set the environment variable AZURE_APPCONFIG_COMPATIBILITY_MODE to False.
- name: Export all keys and feature flags with label test to a json file. To use the microsoft feature management schema when exporting feature flags to a file, set the environment variable AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE to False.
text: az appconfig kv export -n MyAppConfiguration --label test -d file --path D:/abc.json --format json
- name: Export all keys with null label to an App Service application.
text: az appconfig kv export -n MyAppConfiguration -d appservice --appservice-account MyAppService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __export_features(retrieved_features, naming_convention):
)
feature_flags_keyword = FeatureFlagConstants.FEATURE_FLAGS_KEY
try:
env_compatibility_mode = os.environ.get("AZURE_APPCONFIG_FM_COMPATIBLE", True)
env_compatibility_mode = os.environ.get("AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE", True)
compatibility_mode = str(env_compatibility_mode).lower() == "true"
if compatibility_mode:
feature_reserved_keywords = FeatureManagementReservedKeywords.get_keywords(
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def test_azconfig_import_export(self, resource_group, location):
import_separator_features_file_path = os.path.join(TEST_DIR, 'import_separator_features.json')
import_features_alt_syntax_file_path = os.path.join(TEST_DIR, 'import_features_alt_syntax.json')
import_features_random_conditions_file_path = os.path.join(TEST_DIR, 'import_features_random_conditions.json')
os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'True'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'True'

self.kwargs.update({
'label': 'KeyValuesWithFeatures',
Expand Down Expand Up @@ -1075,7 +1075,7 @@ def test_azconfig_import_export(self, resource_group, location):
@ResourceGroupPreparer(parameter_name_for_location='location')
def test_azconfig_import_export_new_fm_schema(self, resource_group, location):
# Feature flags test with new ms fm schema
os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'False'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'False'

config_store_name = self.create_random_name(prefix='NewFmImport', length=24)

Expand Down Expand Up @@ -1548,7 +1548,7 @@ def test_azconfig_import_export_naming_conventions(self, resource_group, locatio
})
_create_config_store(self, self.kwargs)

os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'True'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'True'
import_hyphen_path = os.path.join(TEST_DIR, 'import_features_hyphen.json')
exported_file_path = os.path.join(TEST_DIR, 'export_features_naming.json')
export_underscore_path = os.path.join(TEST_DIR, 'export_features_underscore.json')
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def test_azconfig_import_export_respect_both_schemas_naming_conventions(self, re
_create_config_store(self, self.kwargs)

# # Camel case naming convention
os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'False'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'False'

imported_both_schemas_camel_case_file_path = os.path.join(TEST_DIR, 'respectBothFmSchemaCamelCase.json')
exported_both_schemas_camel_case_file_path = os.path.join(TEST_DIR, 'export_features_both_schema_camel_case_file_path.json')
Expand Down Expand Up @@ -2344,7 +2344,7 @@ def test_azconfig_json_content_type(self, resource_group, location):
- Delete all settings from both stores
"""

os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'True'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'True'
imported_file_path = os.path.join(TEST_DIR, 'json_import.json')
exported_file_path = os.path.join(TEST_DIR, 'json_export.json')
self.kwargs.update({
Expand Down Expand Up @@ -3145,7 +3145,7 @@ def test_azconfig_key_validation(self, resource_group, location):
self.cmd('appconfig feature set --connection-string {connection_string} --feature "{feature}" -y')

# validate keys and features during file import
os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'True'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'True'
imported_file_path = os.path.join(TEST_DIR, 'import_invalid_kv_and_features.json')
expected_export_file_path = os.path.join(TEST_DIR, 'expected_export_valid_kv_and_features.json')
actual_export_file_path = os.path.join(TEST_DIR, 'actual_export_valid_kv_and_features.json')
Expand Down Expand Up @@ -3268,7 +3268,7 @@ def test_azconfig_aad_auth(self, resource_group, location):
self.cmd('appconfig kv set --endpoint {endpoint} --auth-mode login --key {key} --value {value} -y')

# Export from appconfig to file should succeed
os.environ['AZURE_APPCONFIG_FM_COMPATIBLE'] = 'True'
os.environ['AZURE_APPCONFIG_FM_EXPORT_COMPATIBLE'] = 'True'
exported_file_path = os.path.join(TEST_DIR, 'export_aad_1.json')
expected_exported_file_path = os.path.join(TEST_DIR, 'expected_export_aad_1.json')
self.kwargs.update({
Expand Down

0 comments on commit 596662e

Please sign in to comment.