Created
January 25, 2020 06:17
-
-
Save kasunkv/64f067dcc304233e19643db2e2daa2a7 to your computer and use it in GitHub Desktop.
Configuring Azure App Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Hosting; | |
namespace MusicStore.Web | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
CreateHostBuilder(args).Build().Run(); | |
} | |
public static IHostBuilder CreateHostBuilder(string[] args) => | |
Host.CreateDefaultBuilder(args) | |
.ConfigureWebHostDefaults(webBuilder => { | |
webBuilder.UseStartup<Startup>(); | |
}) | |
.ConfigureAppConfiguration((context, config) => { | |
var settings = config.Build(); | |
var appConfigConnection = settings["ConnectionStrings:AppConfiguration"]; | |
if (!string.IsNullOrEmpty(appConfigConnection)) | |
{ | |
config.AddAzureAppConfiguration(options => | |
{ | |
options | |
.Connect(settings["ConnectionStrings:AppConfiguration"]) | |
.UseFeatureFlags(); // Add reature management capabilities | |
}); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment