From 44645b381ffe399e444444cc0011287d4e09fd7e Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 9 Feb 2019 23:08:46 +0800 Subject: Add config. --- Timeline/Program.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Timeline/Program.cs') diff --git a/Timeline/Program.cs b/Timeline/Program.cs index 575ddc81..8ee8822a 100644 --- a/Timeline/Program.cs +++ b/Timeline/Program.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.FileProviders; namespace Timeline { @@ -14,7 +14,13 @@ namespace Timeline { public static void Main(string[] args) { - CreateWebHostBuilder(args).Build().Run(); + CreateWebHostBuilder(args) + .ConfigureAppConfiguration((context, config) => + { + if (context.HostingEnvironment.IsProduction()) + config.AddJsonFile(new PhysicalFileProvider("/etc/webapp/timeline/"), "config.json", true, true); + }) + .Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => -- cgit v1.2.3