-
-
Save justinyoo/f368f907063328a870601e30607b6499 to your computer and use it in GitHub Desktop.
Adding YAML Settings into ASP.NET Core Apps
This file contains 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
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