Created
April 15, 2019 19:02
-
-
Save iqan/e1e30c39aaf9a3344134787fdde22bf7 to your computer and use it in GitHub Desktop.
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
| class Program | |
| { | |
| public static async Task Main(string[] args) | |
| { | |
| var hostBuilder = new HostBuilder() | |
| .ConfigureAppConfiguration((hostContext, configBuilder) => | |
| { | |
| configBuilder.SetBasePath(Directory.GetCurrentDirectory()); | |
| configBuilder.AddJsonFile("appsettings.json", optional: true); | |
| configBuilder.AddJsonFile( | |
| $"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json", | |
| optional: true); | |
| configBuilder.AddEnvironmentVariables(); | |
| }) | |
| .ConfigureLogging((hostContext, configLogging) => | |
| { | |
| configLogging.AddConfiguration(hostContext.Configuration.GetSection("Logging")); | |
| configLogging.AddConsole(); | |
| }) | |
| .ConfigureServices((hostContext, services) => | |
| { | |
| // Here goes your internal application dependencies | |
| // like EntityFramework context, worker, endpoint, etc. | |
| }); | |
| await hostBuilder.RunConsoleAsync(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment