From fe5a27bcaffa837f6d0a193c94058b49c40b508c Mon Sep 17 00:00:00 2001 From: wzh425 Date: Fri, 10 Jan 2025 10:09:47 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20refactor(wasm):=20=20AddMasaStackCo?= =?UTF-8?q?nfigAsync=20Adjustment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceCollectionExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Contrib.Wasm/Masa.Contrib.StackSdks.Config.Wasm/ServiceCollectionExtensions.cs b/src/Contrib.Wasm/Masa.Contrib.StackSdks.Config.Wasm/ServiceCollectionExtensions.cs index 4003ec6..ac211ec 100644 --- a/src/Contrib.Wasm/Masa.Contrib.StackSdks.Config.Wasm/ServiceCollectionExtensions.cs +++ b/src/Contrib.Wasm/Masa.Contrib.StackSdks.Config.Wasm/ServiceCollectionExtensions.cs @@ -5,9 +5,9 @@ namespace Microsoft.Extensions.DependencyInjection; public static class ServiceCollectionExtensions { - public static async Task AddMasaStackConfigAsync(this IServiceCollection services, IConfiguration configuration, string environment) + public static async Task AddMasaStackConfigAsync(this IServiceCollection services, IConfiguration configuration) { - var configs = GetConfigMap(configuration, environment); + var configs = GetConfigMap(configuration); services.TryAddScoped(); services.TryAddSingleton(); @@ -36,7 +36,7 @@ public static IMultiEnvironmentMasaStackConfig GetMultiEnvironmentMasaStackConfi return services.BuildServiceProvider().GetRequiredService(); } - private static Dictionary GetConfigMap(IConfiguration configuration, string environment) + private static Dictionary GetConfigMap(IConfiguration configuration) { var configs = new Dictionary() { @@ -47,7 +47,7 @@ private static Dictionary GetConfigMap(IConfiguration configurat { MasaStackConfigConstant.CLUSTER, configuration.GetValue(MasaStackConfigConstant.CLUSTER) }, { MasaStackConfigConstant.OTLP_URL, configuration.GetValue(MasaStackConfigConstant.OTLP_URL) }, { MasaStackConfigConstant.MASA_STACK, configuration.GetValue(MasaStackConfigConstant.MASA_STACK) }, - { MasaStackConfigConstant.ENVIRONMENT, environment } + { MasaStackConfigConstant.ENVIRONMENT, configuration.GetValue(MasaStackConfigConstant.ENVIRONMENT) } }; return configs; }