2025-04-23 14:46:19 +08:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2024-12-19 16:07:07 +08:00
|
|
|
using Serilog;
|
2025-04-15 17:57:47 +08:00
|
|
|
using Volo.Abp.Modularity.PlugIns;
|
2024-12-19 16:07:07 +08:00
|
|
|
|
2025-04-23 14:46:19 +08:00
|
|
|
namespace JiShe.CollectBus.Host;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Program
|
|
|
|
|
/// </summary>
|
2024-12-19 16:07:07 +08:00
|
|
|
public class Program
|
|
|
|
|
{
|
2025-04-15 17:57:47 +08:00
|
|
|
/// <summary>
|
2025-04-23 14:46:19 +08:00
|
|
|
/// Main
|
2025-04-15 17:57:47 +08:00
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="args"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static async Task Main(string[] args)
|
2024-12-19 16:07:07 +08:00
|
|
|
{
|
2025-04-15 17:57:47 +08:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
builder.Host.UseContentRoot(Directory.GetCurrentDirectory())
|
|
|
|
|
.UseSerilog((context, loggerConfiguration) =>
|
|
|
|
|
{
|
|
|
|
|
loggerConfiguration.ReadFrom.Configuration(context.Configuration);
|
|
|
|
|
})
|
|
|
|
|
.UseAutofac();
|
2025-04-23 14:46:19 +08:00
|
|
|
var configuration = builder.Configuration;
|
2025-04-15 17:57:47 +08:00
|
|
|
await builder.AddApplicationAsync<CollectBusHostModule>(options =>
|
|
|
|
|
{
|
2025-04-23 14:46:19 +08:00
|
|
|
options.PlugInSources.AddFolder((configuration["PlugInFolder"].IsNullOrWhiteSpace()? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"): configuration["PlugInFolder"]) ?? string.Empty);
|
2025-04-15 17:57:47 +08:00
|
|
|
});
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
await app.InitializeApplicationAsync();
|
|
|
|
|
await app.RunAsync();
|
2024-12-19 16:07:07 +08:00
|
|
|
}
|
|
|
|
|
}
|