in Utils/azure-toolkit-ide-libs/azure-toolkit-ide-common-lib/src/main/java/com/microsoft/azure/toolkit/ide/common/store/AzureConfigInitializer.java [50:136]
public static void initialize(String defaultMachineId, String pluginName, String pluginVersion) {
String machineId = AzureStoreManager.getInstance().getMachineStore().getProperty(TELEMETRY,
TELEMETRY_INSTALLATION_ID);
if (StringUtils.isBlank(machineId) || !InstallationIdUtils.isValidHashMac(machineId)) {
machineId = defaultMachineId;
}
final AzureConfiguration config = Azure.az().config();
config.setMachineId(machineId);
final IIdeStore ideStore = AzureStoreManager.getInstance().getIdeStore();
final String allowTelemetry = ideStore.getProperty(TELEMETRY, TELEMETRY_ALLOW_TELEMETRY, "true");
config.setTelemetryEnabled(Boolean.parseBoolean(allowTelemetry));
final String enableAuthPersistence = ideStore.getProperty(OTHER, ENABLE_AUTH_PERSISTENCE, "true");
config.setAuthPersistenceEnabled(Boolean.parseBoolean(enableAuthPersistence));
final String azureCloud = ideStore.getProperty(ACCOUNT, AZURE_ENVIRONMENT_KEY, "Azure");
config.setCloud(azureCloud);
final String funcPath = ideStore.getProperty(FUNCTION, FUNCTION_CORE_TOOLS_PATH, "");
if (StringUtils.isNotBlank(funcPath) && Files.exists(Paths.get(funcPath))) {
config.setFunctionCoreToolsPath(funcPath);
}
final String cliPath = ideStore.getProperty(COMMON, AZURE_CLI_PATH, "");
if (StringUtils.isNotBlank(cliPath) && Files.exists(Paths.get(cliPath))) {
config.setAzureCliPath(cliPath);
}
final String storageExplorerPath = ideStore.getProperty(STORAGE, STORAGE_EXPLORER_PATH, "");
if (StringUtils.isNoneBlank(storageExplorerPath)) {
config.setStorageExplorerPath(storageExplorerPath);
}
final String pageSize = ideStore.getProperty(COMMON, PAGE_SIZE, "99");
if (StringUtils.isNotEmpty(pageSize)) {
config.setPageSize(Integer.parseInt(pageSize));
}
final String monitorRows = ideStore.getProperty(MONITOR, MONITOR_TABLE_ROWS, "200");
if (StringUtils.isNotEmpty(monitorRows)) {
config.setMonitorQueryRowNumber(Integer.parseInt(monitorRows));
}
final String defaultDocumentsLabelFields = String.join(";", AzureConfiguration.DEFAULT_DOCUMENT_LABEL_FIELDS);
final String documentsLabelFields = ideStore.getProperty(COSMOS, DOCUMENTS_LABEL_FIELDS, defaultDocumentsLabelFields);
if (StringUtils.isNoneBlank(documentsLabelFields)) {
config.setDocumentsLabelFields(Arrays.stream(documentsLabelFields.split(";")).collect(Collectors.toList()));
}
final String defaultDotnetRuntimePath = getDotnetRuntimePath();
final String dotnetRuntimePath = ideStore.getProperty(BICEP, DOTNET_RUNTIME_PATH, defaultDotnetRuntimePath);
if (StringUtils.isNoneBlank(dotnetRuntimePath)) {
config.setDotnetRuntimePath(dotnetRuntimePath);
}
final String consumerGroupName = ideStore.getProperty(EVENT_HUBS, CONSUMER_GROUP_NAME, "$Default");
if (StringUtils.isNotBlank(consumerGroupName)) {
config.setEventHubsConsumerGroup(consumerGroupName);
}
final String azuritePath = ideStore.getProperty(AZURITE, AZURITE_PATH, "");
if (StringUtils.isNotBlank(azuritePath)) {
config.setAzuritePath(azuritePath);
}
final String azuriteWorkspace = ideStore.getProperty(AZURITE, AZURITE_WORKSPACE, "");
if (StringUtils.isNotBlank(azuriteWorkspace)) {
config.setAzuriteWorkspace(azuriteWorkspace);
}
final Boolean enableLeaseMode = Boolean.valueOf(ideStore.getProperty(AZURITE, ENABLE_LEASE_MODE, "false"));
config.setEnableLeaseMode(enableLeaseMode);
final Boolean enablePreloading = Boolean.valueOf(ideStore.getProperty(COMMON, ENABLE_PRELOADING, "false"));
config.setEnablePreloading(enablePreloading);
ideStore.getProperty(TELEMETRY, TELEMETRY_PLUGIN_VERSION, "");
final String userAgent = String.format("%s, v%s, machineid:%s", pluginName, pluginVersion,
config.getTelemetryEnabled() ? config.getMachineId() : StringUtils.EMPTY);
config.setUserAgent(userAgent);
config.setProduct(pluginName);
config.setLogLevel("NONE");
config.setVersion(pluginVersion);
saveAzConfig();
}