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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="config.json">
|
||||
|
||||
@@ -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<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)
|
||||
.AddJsonFile($"config.{builder.Environment.EnvironmentName}.json", true)
|
||||
.AddEnvironmentVariables(prefix: "CRYSTAL_")
|
||||
.AddCommandLine(args);
|
||||
builder.UseContentRoot(Environment.CurrentDirectory);
|
||||
|
||||
builder.Logging.ClearProviders()
|
||||
builder.ConfigureWebHost(webHost =>
|
||||
{
|
||||
webHost.UseStartup<Startup>();
|
||||
|
||||
webHost.UseKestrel(kestrel =>
|
||||
{
|
||||
});
|
||||
});
|
||||
|
||||
builder.ConfigureLogging(logging =>
|
||||
{
|
||||
logging.ClearProviders()
|
||||
.SetMinimumLevel(LogLevel.Trace)
|
||||
.AddNLog();
|
||||
});
|
||||
|
||||
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