ASP.NET Razor website for https://wotdn.nightmare.haus
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.7 KiB
47 lines
1.7 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Threading.Tasks; |
|
using Microsoft.AspNetCore.Hosting; |
|
using Microsoft.Extensions.Configuration; |
|
using Microsoft.Extensions.Hosting; |
|
using Microsoft.Extensions.Logging; |
|
using Newtonsoft.Json; |
|
using System.IO; |
|
|
|
namespace NightmareCoreWeb2 |
|
{ |
|
public class Program |
|
{ |
|
public static string MysqlServer; |
|
public static string MysqlUser; |
|
public static string MysqlDatabase; |
|
public static string MysqlPort; |
|
public static string MysqlPassword; |
|
public static string connStr; |
|
public static void Main(string[] args) |
|
{ |
|
using (StreamReader r = new StreamReader("config.json")) |
|
{ |
|
string json = r.ReadToEnd(); |
|
MysqlConfig config = JsonConvert.DeserializeObject<MysqlConfig>(json); |
|
Program.MysqlServer = config.MysqlServer; |
|
Program.MysqlUser = config.MysqlUsername; |
|
Program.MysqlDatabase = config.MysqlDatabase; |
|
Program.MysqlPassword = config.MysqlPassword; |
|
Program.MysqlPort = config.MysqlPort; |
|
connStr = $"SslMode=None;server={Program.MysqlServer};user={Program.MysqlUser};database={Program.MysqlDatabase};port={Program.MysqlPort};password={Program.MysqlPassword}"; |
|
|
|
|
|
} |
|
CreateHostBuilder(args).Build().Run(); |
|
} |
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) => |
|
Host.CreateDefaultBuilder(args) |
|
.ConfigureWebHostDefaults(webBuilder => |
|
{ |
|
webBuilder.UseStartup<Startup>(); |
|
}); |
|
} |
|
}
|
|
|