mirror of
https://github.com/MeowCraftMC/CrystalConnector
synced 2025-05-22 02:43:00 +00:00
@@ -19,6 +19,9 @@
|
|||||||
<PackageReference Include="Telegram.Bot" Version="19.0.0" />
|
<PackageReference Include="Telegram.Bot" Version="19.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="config.json">
|
<None Update="config.json">
|
||||||
|
|||||||
+30
-10
@@ -1,4 +1,5 @@
|
|||||||
using CrystalConnector;
|
using CrystalConnector;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@@ -6,20 +7,39 @@ using Microsoft.Extensions.Logging;
|
|||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
|
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
|
||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
var builder = Host.CreateDefaultBuilder(args);
|
||||||
|
|
||||||
builder.Services.AddHostedService<CrystalService>();
|
builder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddHostedService<CrystalService>();
|
||||||
|
});
|
||||||
|
|
||||||
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)
|
builder.UseContentRoot(Environment.CurrentDirectory);
|
||||||
.AddJsonFile($"config.{builder.Environment.EnvironmentName}.json", true)
|
|
||||||
.AddEnvironmentVariables(prefix: "CRYSTAL_")
|
|
||||||
.AddCommandLine(args);
|
|
||||||
|
|
||||||
builder.Logging.ClearProviders()
|
builder.ConfigureWebHost(webHost =>
|
||||||
.SetMinimumLevel(LogLevel.Trace)
|
{
|
||||||
.AddNLog();
|
webHost.UseStartup<Startup>();
|
||||||
|
|
||||||
|
webHost.UseKestrel(kestrel =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.ConfigureLogging(logging =>
|
||||||
|
{
|
||||||
|
logging.ClearProviders()
|
||||||
|
.SetMinimumLevel(LogLevel.Trace)
|
||||||
|
.AddNLog();
|
||||||
|
});
|
||||||
|
|
||||||
using var host = builder.Build();
|
using var host = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,2 +1,16 @@
|
|||||||
{
|
{
|
||||||
|
"server": {
|
||||||
|
"listen": [
|
||||||
|
{
|
||||||
|
"enabled": true,
|
||||||
|
"ip": "0.0.0.0",
|
||||||
|
"port": 33927,
|
||||||
|
"https": {
|
||||||
|
"enabled": false,
|
||||||
|
"cert": "cert.pfx",
|
||||||
|
"password": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user