[성현모] Operation 레이아웃, 페이지 설정
This commit is contained in:
@ -1,13 +1,82 @@
|
||||
using Radzen;
|
||||
using SystemX.Core.Config.Model;
|
||||
using SystemX.Core.DB;
|
||||
using SystemX.Core.Services;
|
||||
using Web.Operation.Components;
|
||||
using Web.Operation.Services;
|
||||
using WebClient.Library.Config;
|
||||
using WebClient.Library.Model;
|
||||
|
||||
|
||||
string configDir = @"../../Config";
|
||||
string configFileName = "WebClient.Operation.Config.json";
|
||||
|
||||
//raed log4net configs
|
||||
if (LogXnet.ReadConfig(@$"{configDir}/LogXnetConfig.json") == true)
|
||||
{
|
||||
LogXnet.WriteLine("LogXnet Init Success");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("LogXnet Init Failed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddRadzenComponents();
|
||||
|
||||
//singleton
|
||||
builder.Services.AddSingleton<ConfigService<WebClientConfig>>();
|
||||
|
||||
|
||||
//scoped
|
||||
builder.Services.AddScoped<PopupService>();
|
||||
|
||||
//db
|
||||
builder.Services.AddSingleton<DbContextProvider>(); // Generic <20><><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
//config preload, auth set
|
||||
ConfigService<WebClientConfig> preloadConfig = new ConfigService<WebClientConfig>();
|
||||
if (preloadConfig.OpenConfig($@"{configDir}/{configFileName}") == true)
|
||||
{
|
||||
var config = preloadConfig.GetConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogXnet.WriteLine("Config Preload Load Error.", LogXLabel.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
//read api config and set
|
||||
string serverUrl = string.Empty;
|
||||
var configService = app.Services.GetService<ConfigService<WebClientConfig>>();
|
||||
bool isIIS = false;
|
||||
|
||||
if (configService?.OpenConfig($@"{configDir}/{configFileName}") == true)
|
||||
{
|
||||
LogXnet.WriteLine("WebClient Config Success.");
|
||||
var apiConfig = ConfigService<WebClientConfig>.Config;
|
||||
if (apiConfig != null)
|
||||
{
|
||||
serverUrl = $"{apiConfig?.Server?.Address}:{apiConfig?.Server?.Port}";
|
||||
isIIS = apiConfig!.Server.IIS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogXnet.WriteLine("WebClient Config Error.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
@ -24,4 +93,13 @@ app.UseAntiforgery();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode();
|
||||
|
||||
app.Run();
|
||||
if (isIIS == true)
|
||||
{
|
||||
app.Run();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogXnet.WriteLine($"Operation Url: {serverUrl}");
|
||||
app.Run($"{serverUrl}");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user