diff --git a/CrystalConnector/CrystalConnector.csproj b/CrystalConnector/CrystalConnector.csproj
index 09b702b..75fdd48 100644
--- a/CrystalConnector/CrystalConnector.csproj
+++ b/CrystalConnector/CrystalConnector.csproj
@@ -19,6 +19,9 @@
+
+
+
diff --git a/CrystalConnector/Program.cs b/CrystalConnector/Program.cs
index 544427f..785f193 100644
--- a/CrystalConnector/Program.cs
+++ b/CrystalConnector/Program.cs
@@ -1,4 +1,5 @@
using CrystalConnector;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -6,20 +7,39 @@ using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
-var builder = Host.CreateApplicationBuilder(args);
+var builder = Host.CreateDefaultBuilder(args);
-builder.Services.AddHostedService();
+builder.ConfigureServices(services =>
+{
+ services.AddHostedService();
+});
-builder.Environment.ContentRootPath = Directory.GetCurrentDirectory();
+builder.ConfigureAppConfiguration((context, config) =>
+{
+ config.Sources.Clear();
+ config.AddJsonFile("config.json", optional: true, reloadOnChange: true)
+ .AddJsonFile($"config.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true)
+ .AddCommandLine(args)
+ .AddEnvironmentVariables();
+});
-builder.Configuration.AddJsonFile("config.json", true)
- .AddJsonFile($"config.{builder.Environment.EnvironmentName}.json", true)
- .AddEnvironmentVariables(prefix: "CRYSTAL_")
- .AddCommandLine(args);
+builder.UseContentRoot(Environment.CurrentDirectory);
-builder.Logging.ClearProviders()
- .SetMinimumLevel(LogLevel.Trace)
- .AddNLog();
+builder.ConfigureWebHost(webHost =>
+{
+ webHost.UseStartup();
+
+ webHost.UseKestrel(kestrel =>
+ {
+ });
+});
+
+builder.ConfigureLogging(logging =>
+{
+ logging.ClearProviders()
+ .SetMinimumLevel(LogLevel.Trace)
+ .AddNLog();
+});
using var host = builder.Build();
diff --git a/CrystalConnector/Startup.cs b/CrystalConnector/Startup.cs
new file mode 100644
index 0000000..4796ca8
--- /dev/null
+++ b/CrystalConnector/Startup.cs
@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace CrystalConnector;
+
+public class Startup
+{
+ public IConfiguration Config { get; }
+
+ public Startup(IConfiguration config)
+ {
+ Config = config;
+ }
+
+ public void ConfigureServices(IServiceCollection services)
+ {
+ }
+
+ public void Configure(IApplicationBuilder app)
+ {
+ }
+}
\ No newline at end of file
diff --git a/CrystalConnector/config.json b/CrystalConnector/config.json
index 7a73a41..bdc18c6 100644
--- a/CrystalConnector/config.json
+++ b/CrystalConnector/config.json
@@ -1,2 +1,16 @@
{
+ "server": {
+ "listen": [
+ {
+ "enabled": true,
+ "ip": "0.0.0.0",
+ "port": 33927,
+ "https": {
+ "enabled": false,
+ "cert": "cert.pfx",
+ "password": ""
+ }
+ }
+ ]
+ }
}
\ No newline at end of file