Skip to content

Commit

Permalink
Move app configuration into post build step
Browse files Browse the repository at this point in the history
  • Loading branch information
nwarms committed Dec 13, 2024
1 parent da9592c commit 71ea971
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion DfE.FindInformationAcademiesTrusts/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static void Main(string[] args)

var app = builder.Build();
PostBuildSetup.ConfigureApp(app);
app.UseAzureAppConfiguration();
app.Run();
}
catch (Exception ex)
Expand Down
7 changes: 7 additions & 0 deletions DfE.FindInformationAcademiesTrusts/Setup/PostBuildSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,12 @@ public static void ConfigureApp(WebApplication app)
app.MapRazorPages();
app.UseMiddleware<ResponseHeadersMiddleware>();
app.MapHealthChecks("/health").AllowAnonymous();

// Only setup Azure App Configuration if the Connection string is present
var appConfigString = app.Configuration["AppConfig"];
if (!string.IsNullOrWhiteSpace(appConfigString))
{
app.UseAzureAppConfiguration();
}
}
}

0 comments on commit 71ea971

Please sign in to comment.