Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created January 25, 2017 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/f368f907063328a870601e30607b6499 to your computer and use it in GitHub Desktop.
Save justinyoo/f368f907063328a870601e30607b6499 to your computer and use it in GitHub Desktop.
Adding YAML Settings into ASP.NET Core Apps
public class Startup
{
...
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Gets the app settings as strongly-typed instance
var aad = this.Configuration.Get<AzureAdSettings>("authentication:azureAd");
// Add settings instance as a singleton for DI
services.AddSingleton<AzureAdSettings>(aad);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment