chore: 优化authserver代码
This commit is contained in:
14
applications/KonSoft.AuthServer/Controller/HomeController.cs
Normal file
14
applications/KonSoft.AuthServer/Controller/HomeController.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Volo.Abp.AspNetCore.Mvc;
|
||||
|
||||
namespace KonSoft.Controller
|
||||
{
|
||||
public class HomeController : AbpController
|
||||
{
|
||||
[HttpGet("health")]
|
||||
public ActionResult Health()
|
||||
{
|
||||
return Ok("online");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,6 +59,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Microservices\KonSoft.Shared.Hosting.Microservices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using KonSoft.Admin;
|
||||
using KonSoft.Admin.EntityFrameworkCore;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using KonSoft.Shared.Hosting.Microservices;
|
||||
using KonSoft.Shared.Localization.Localization;
|
||||
@ -10,6 +12,7 @@ using Volo.Abp.Account;
|
||||
using Volo.Abp.Account.Localization;
|
||||
using Volo.Abp.Account.Web;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
|
||||
using Volo.Abp.Auditing;
|
||||
@ -24,7 +27,10 @@ namespace KonSoft;
|
||||
[DependsOn(
|
||||
typeof(AbpAccountWebOpenIddictModule),
|
||||
typeof(AbpAccountApplicationModule),
|
||||
typeof(AbpAccountHttpApiModule),
|
||||
typeof(AbpAccountHttpApiModule),
|
||||
typeof(AdminApplicationModule),
|
||||
typeof(AdminEntityFrameworkCoreModule),
|
||||
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
|
||||
typeof(KonSoftSharedHostingMicroservicesModule)
|
||||
)]
|
||||
public class KonSoftAuthServerModule : AbpModule
|
||||
@ -54,7 +60,7 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
|
||||
{
|
||||
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx",
|
||||
"59464dba-b66e-48cd-8b81-2e4a9c08c977");
|
||||
configuration["Certificate:Password"]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using KonSoft.Shared.Hosting.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KonSoft;
|
||||
|
||||
@ -12,45 +10,27 @@ public class Program
|
||||
{
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
.MinimumLevel.Debug()
|
||||
#else
|
||||
.MinimumLevel.Information()
|
||||
#endif
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
||||
.WriteTo.Async(c => c.Console())
|
||||
.CreateLogger();
|
||||
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||
|
||||
SerilogConfigurationHelper.Configure(assemblyName);
|
||||
try
|
||||
{
|
||||
Log.Information("Starting KonSoft.AuthServer.");
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Host.AddAppSettingsSecretsJson()
|
||||
.UseAutofac()
|
||||
.UseSerilog();
|
||||
await builder.AddApplicationAsync<KonSoftAuthServerModule>();
|
||||
var app = builder.Build();
|
||||
Log.Information($"Starting {assemblyName}.");
|
||||
var app = await ApplicationBuilderHelper
|
||||
.BuildApplicationAsync<KonSoftAuthServerModule>(args);
|
||||
await app.InitializeApplicationAsync();
|
||||
await app.RunAsync();
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is HostAbortedException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
Log.Fatal(ex, "KonSoft.AuthServer terminated unexpectedly!");
|
||||
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
||||
return 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
await Log.CloseAndFlushAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,8 @@
|
||||
{
|
||||
"App": {
|
||||
"SelfUrl": "https://localhost:44322",
|
||||
"ClientUrl": "http://localhost:4200",
|
||||
"CorsOrigins": "https://*.KonSoft.com,http://localhost:4200,https://localhost:44316,https://localhost:44370",
|
||||
"RedirectAllowedUrls": "http://localhost:4200,https://localhost:44319,https://localhost:44316,https://localhost:44347"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Default": "Host=localhost;Port=5432;Database=KonSoft;User ID=root;Password=myPassword;"
|
||||
},
|
||||
"Redis": {
|
||||
"Configuration": "127.0.0.1"
|
||||
},
|
||||
"StringEncryption": {
|
||||
"DefaultPassPhrase": "kxtywyrXW4i7vijT"
|
||||
"AgileConfig": {
|
||||
"appId": "KonSoft.Admin.HttpApi.Host",
|
||||
"name": "KonSoft.Admin.HttpApi.Host",
|
||||
"nodes": "https://config.konsoft.top/",
|
||||
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user