From d659d1c3438a8cfd4365ee5b2e10babe1575e346 Mon Sep 17 00:00:00 2001 From: Yunge Zhu Date: Mon, 29 Jan 2024 16:29:12 +0800 Subject: [PATCH 1/2] update code to read config from appconfig --- src/api/Program.cs | 3 ++- src/api/Todo.Api.csproj | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/Program.cs b/src/api/Program.cs index abace678..0448b316 100644 --- a/src/api/Program.cs +++ b/src/api/Program.cs @@ -1,10 +1,11 @@ using Azure.Identity; using Microsoft.EntityFrameworkCore; using SimpleTodo.Api; +using Microsoft.Extensions.Configuration.AzureAppConfiguration; var builder = WebApplication.CreateBuilder(args); var credential = new ChainedTokenCredential(new AzureDeveloperCliCredential(), new DefaultAzureCredential()); -builder.Configuration.AddAzureKeyVault(new Uri(builder.Configuration["AZURE_KEY_VAULT_ENDPOINT"]), credential); +builder.Configuration.AddAzureAppConfiguration(builder.Configuration["AZURE_APP_CONFIGURATION_ENDPOINT"]); builder.Services.AddScoped(); builder.Services.AddDbContext(options => diff --git a/src/api/Todo.Api.csproj b/src/api/Todo.Api.csproj index b8ebfbf9..c8039471 100644 --- a/src/api/Todo.Api.csproj +++ b/src/api/Todo.Api.csproj @@ -12,6 +12,7 @@ + From dfae10f5e2f14c5a70b79c24b9733ab44be092a7 Mon Sep 17 00:00:00 2001 From: Yunge Zhu Date: Mon, 29 Jan 2024 17:08:16 +0800 Subject: [PATCH 2/2] temp add aspire azure.yaml file --- azure.aspire.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 azure.aspire.yaml diff --git a/azure.aspire.yaml b/azure.aspire.yaml new file mode 100644 index 00000000..91ab0410 --- /dev/null +++ b/azure.aspire.yaml @@ -0,0 +1,42 @@ +name: eShopLite +services: + app: + language: dotnet + project: .\eShopLite.AppHost\eShopLite.AppHost.csproj + host: containerapp +bindings: + - name: catalogservice2db + sourceType: containerapp + sourceResource: catalogservice + targetType: postgresql + targetResource: eshoppostgresql + storeType: appconfig + storeResource: eshopappcs + - name: basketservice2cache + sourceType: containerapp + sourceResource: basketservice + targetType: redis + targetResource: eshopredis + storeType: appconfig + storeResource: eshopappcs + - name: frontend2catalog + sourceType: containerapp + sourceResource: frontend + targetType: containerapp + targetResource: catalogservice + storeType: appconfig + storeResource: eshopappcs + - name: frontend2basket + sourceType: containerapp + sourceResource: frontend + targetType: containerapp + targetResource: basketservice + storeType: appconfig + storeResource: eshopappcs + - name: catalogappdb + sourceType: containerapp + sourceResource: catalogapp + targetType: postgresql + targetResource: eshoppostgresql + storeType: appconfig + storeResource: eshopappcs \ No newline at end of file