250501 커밋
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
namespace BrokerApiServer.Common;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BrokerApiServer;
|
||||
public class ApiControllerBase: ControllerBase
|
||||
{
|
||||
protected string PlanetId => HttpContext.Items["planet_id"]?.ToString() ?? string.Empty;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using CommandLine;
|
||||
|
||||
namespace BrokerApiServer.Common;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
public class CommandLineOption
|
||||
{
|
||||
@@ -9,7 +9,4 @@ public class CommandLineOption
|
||||
|
||||
[Option('s', "swagger", Default = false, Required = false, HelpText = "Show Swagger Mode")]
|
||||
public bool UseSwagger { get; init; } = false;
|
||||
|
||||
[Option('n', "named-pipe", Default = false, Required = false, HelpText = "User Named Pipe")]
|
||||
public bool UseNamedPipe { get; init; } = false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BrokerApiServer.Common;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
public static class Const
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BrokerApiServer.Common;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace BrokerCore.Common;
|
||||
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
using BrokerApiServer.Common;
|
||||
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCore;
|
||||
|
||||
using Services;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
using BrokerApiCore;
|
||||
|
||||
/// <summary>
|
||||
/// 엑세스 토큰 인증이 필요한 컨트롤러를 지정하는 애노테이션(Attribute) 정의
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using BrokerApiCore;
|
||||
|
||||
namespace BrokerCore.Common;
|
||||
|
||||
using BrokerApiServer.Common;
|
||||
|
||||
using Services;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
/// <summary>
|
||||
/// 엑세스 토큰 인증이 필요한 컨트롤러를 지정하는 애노테이션(Attribute) 정의
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace BrokerCore.Common;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using BrokerApiCore;
|
||||
|
||||
using Services;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public class RequireUserJwtAuthAttribute : System.Attribute, IAsyncActionFilter
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
using BrokerApiServer.Common;
|
||||
using ServerCore;
|
||||
using BrokerApiCore;
|
||||
|
||||
using BrokerCore.ApiModels;
|
||||
using BrokerCore.Common;
|
||||
|
||||
namespace CaliGameApi.Middlewares;
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
public class ResultExceptionFilter : IExceptionFilter
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace BrokerApiServer.Common;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCore;
|
||||
|
||||
public class ResultLoggingMiddleware : IMiddleware
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace BrokerApiServer.Common;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
using Microsoft.OpenApi.Any;
|
||||
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServerCommon;
|
||||
using BrokerCore.ApiModels;
|
||||
using BrokerCore.Services;
|
||||
|
||||
namespace BrokerApiServer.Controllers;
|
||||
|
||||
using BrokerCore.Common;
|
||||
using BrokerCore.DbEntity;
|
||||
|
||||
using Common;
|
||||
using BrokerApiServer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
|
||||
using BrokerApiCore;
|
||||
namespace BrokerApiServer.Controllers;
|
||||
|
||||
[Route("api/v1/admin")]
|
||||
[ApiController]
|
||||
// 운영자만 접근 가능한 컨트롤러
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
using BrokerCore.ApiModels;
|
||||
using BrokerCore.Services;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using BrokerApiCore;
|
||||
|
||||
namespace BrokerApiServer.Controllers;
|
||||
|
||||
using BrokerCore.Common;
|
||||
|
||||
[Route("api/v1/planet")]
|
||||
[ApiController, SwaggerTag("플래닛의 인증 처리")]
|
||||
// 플래닛 인증 컨트롤러
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using System.ComponentModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BrokerApiServer.Controllers;
|
||||
using BrokerApiCore;
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
using BrokerCore.ApiModels;
|
||||
using BrokerCore.Common;
|
||||
using BrokerCore.DbEntity;
|
||||
using BrokerCore.Services;
|
||||
|
||||
using Common;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
[Route("api/v1/planet/user")]
|
||||
[ApiController, SwaggerTag("**플래닛 유저의 로그인 및 교환 처리**<br> - /api/v1/planet/auth를 통해 accessToken을 발급받은 후 사용 <br> - Bearer 형식 Hearder로 인증")]
|
||||
|
||||
@@ -1,27 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Text;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCore;
|
||||
using BrokerApiCore;
|
||||
|
||||
|
||||
using BrokerCore;
|
||||
using BrokerCore.Repository;
|
||||
using BrokerCore.Repository.Context;
|
||||
using BrokerCore.Services;
|
||||
using BrokerCore.Common;
|
||||
|
||||
namespace BrokerApiServer.Extensions;
|
||||
|
||||
using BrokerCore.Meta;
|
||||
|
||||
using Common;
|
||||
|
||||
using NLog.Config;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
public static class AppBuilderExtensions
|
||||
{
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ControlCenter.NamedPipe;
|
||||
using ControlCenter.NamedPipe;
|
||||
using ControlCenter.NamedPipeHost.Manager;
|
||||
using ServerControlCenter;
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace BrokerApiServer.NamedPipePacketHandler;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
public class ForceStopServerMessageReceiver : NamedPipeReceiver<A2S_REQ_FORCE_STOP_SERVER>
|
||||
{
|
||||
private readonly ServerInfoManager m_info_manager;
|
||||
|
||||
|
||||
public ForceStopServerMessageReceiver(ServerInfoManager infoManager)
|
||||
{
|
||||
m_info_manager = infoManager;
|
||||
@@ -32,8 +24,8 @@ public class ForceStopServerMessageReceiver : NamedPipeReceiver<A2S_REQ_FORCE_ST
|
||||
|
||||
// 정보 전달 대기
|
||||
await Task.Delay(1_000);
|
||||
|
||||
|
||||
// process 종료
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using ControlCenter.NamedPipeHost.Manager;
|
||||
using ControlCenter.NamedPipeHost.NamedPipe;
|
||||
using ServerControlCenter;
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCore;
|
||||
|
||||
namespace BrokerApiServer.NamedPipePacketHandler;
|
||||
namespace BrokerApiServer;
|
||||
|
||||
public class StopServerMessageReceiver : NamedPipeReceiver<A2S_REQ_STOP_SERVER>
|
||||
{
|
||||
private readonly ServerInfoManager m_info_manager;
|
||||
|
||||
|
||||
public StopServerMessageReceiver(ServerInfoManager infoManager)
|
||||
{
|
||||
m_info_manager = infoManager;
|
||||
@@ -19,11 +19,11 @@ public class StopServerMessageReceiver : NamedPipeReceiver<A2S_REQ_STOP_SERVER>
|
||||
Log.getLogger().debug($"{nameof(StopServerMessageReceiver)}: Receive - message_id[{message_id}] / message[{message}]");
|
||||
|
||||
m_info_manager.setServerStatus(ServerStatus.Stop);
|
||||
|
||||
|
||||
// 정보 전달 대기
|
||||
await Task.Delay(1_000);
|
||||
|
||||
|
||||
// process 종료
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
using System.Reflection;
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
using BrokerApiServer.Common;
|
||||
using BrokerApiServer.Extensions;
|
||||
using CaliGameApi.Middlewares;
|
||||
using BrokerApiServer;
|
||||
using CommandLine;
|
||||
using ControlCenter.NamedPipeHost.Extensions;
|
||||
using ServerCore;
|
||||
|
||||
//=============================================================================
|
||||
// 인자 설정
|
||||
//=============================================================================
|
||||
var port = 12000;
|
||||
var use_swagger = false;
|
||||
var use_named_pipe = false;
|
||||
var parsed_arguments = Parser.Default.ParseArguments<CommandLineOption>(args);
|
||||
if (parsed_arguments is Parsed<CommandLineOption> parsed)
|
||||
{
|
||||
port = parsed.Value.Port;
|
||||
use_swagger = parsed.Value.UseSwagger ? true : false;
|
||||
use_named_pipe = parsed.Value.UseNamedPipe ? true : false;
|
||||
}
|
||||
|
||||
var cmd_options = new string[] { "--urls", $"http://*:{port}" };
|
||||
@@ -35,11 +27,8 @@ builder.Services.AddHealthChecks();
|
||||
builder.Services.AddSwaggerGen(SwaggerSettingHelper.setSwaggerGen);
|
||||
|
||||
var assemblies = new List<Assembly>(AppDomain.CurrentDomain.GetAssemblies());
|
||||
if (use_named_pipe)
|
||||
{
|
||||
builder.Services.AddNamedPipelineClientManager(assemblies, ServerControlCenter.ServerType.BrokerApi,
|
||||
ServiceCategory.Caliverse.ToString(), NetworkHelper.getEthernetLocalIPv4(), port);
|
||||
}
|
||||
builder.Services.AddNamedPipelineClientManager(assemblies, ServerControlCenter.ServerType.BrokerApi,
|
||||
ServiceCategory.Caliverse.ToString(), NetworkHelper.getEthernetLocalIPv4(), port);
|
||||
|
||||
var app = builder.Build();
|
||||
app.UseCors("Everything");
|
||||
@@ -69,9 +58,6 @@ app.Services.GetRequiredService<IHostApplicationLifetime>().ApplicationStarted.R
|
||||
});
|
||||
app.Services.GetRequiredService<IHostApplicationLifetime>().ApplicationStopped.Register(Log.shutdown);
|
||||
|
||||
if (use_named_pipe)
|
||||
{
|
||||
app.UseNamedPipelineClientManager();
|
||||
}
|
||||
app.UseNamedPipelineClientManager();
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-p 12000 -s",
|
||||
"commandLineArgs": "-p 12000 -s --named-pipe true",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
|
||||
Reference in New Issue
Block a user