Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (42 loc) · 1.57 KB
/
Copy pathProgram.cs
File metadata and controls
46 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
using System.Linq;
namespace BotSharp.WebHost
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
var env = hostingContext.HostingEnvironment;
string dir = Path.GetFullPath(env.ContentRootPath);
string settingsFolder = Path.Combine(dir, "Settings");
if (!Directory.Exists(settingsFolder))
{
dir = Path.GetFullPath(env.ContentRootPath + "/..");
}
settingsFolder = Path.Combine(dir, "Settings");
Console.WriteLine($"Settings folder: {settingsFolder}");
var settings = Directory.GetFiles(settingsFolder, "*.json");
settings.ToList().ForEach(setting =>
{
Console.WriteLine($"Read {setting}");
config.AddJsonFile(setting, optional: false, reloadOnChange: true);
});
})
#if RASA
.UseUrls("http://0.0.0.0:5000")
#else
.UseUrls("http://0.0.0.0:3112")
#endif
.UseStartup<Startup>()
.Build();
}
}