mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-06 10:42:28 +00:00
Split project listen urls
This commit is contained in:
parent
4caef5fd63
commit
8cb9abfd3e
6 changed files with 25 additions and 6 deletions
|
@ -22,7 +22,7 @@ public static class Program
|
|||
webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<ApiStartup>();
|
||||
webBuilder.UseUrls(ServerConfiguration.Instance.ListenUrl);
|
||||
webBuilder.UseUrls(ServerConfiguration.Instance.ApiListenUrl);
|
||||
}
|
||||
)
|
||||
.ConfigureLogging
|
||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.OpenApi.Models;
|
|||
|
||||
namespace LBPUnion.ProjectLighthouse.API.Startup;
|
||||
|
||||
public class ApiStartup
|
||||
public sealed class ApiStartup
|
||||
{
|
||||
public ApiStartup(IConfiguration configuration)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ public class ApiStartup
|
|||
);
|
||||
}
|
||||
|
||||
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
#if DEBUG
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
|
|
@ -28,7 +28,7 @@ public static class Program
|
|||
{
|
||||
webBuilder.UseStartup<GameApiStartup>();
|
||||
webBuilder.UseWebRoot("StaticFiles");
|
||||
webBuilder.UseUrls(ServerConfiguration.Instance.ListenUrl);
|
||||
webBuilder.UseUrls(ServerConfiguration.Instance.GameApiListenUrl);
|
||||
}
|
||||
)
|
||||
.ConfigureLogging
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Hosting.Internal;
|
||||
|
@ -19,6 +20,7 @@ public class DebugWarmupLifetime : IHostLifetime
|
|||
private CancellationTokenRegistration applicationStartedRegistration;
|
||||
|
||||
private readonly ConsoleLifetime consoleLifetime;
|
||||
public static ServerType ServerType;
|
||||
|
||||
public DebugWarmupLifetime
|
||||
(
|
||||
|
@ -37,7 +39,13 @@ public class DebugWarmupLifetime : IHostLifetime
|
|||
{
|
||||
using HttpClient client = new();
|
||||
|
||||
string url = ServerConfiguration.Instance.ListenUrl;
|
||||
string url = ServerType switch
|
||||
{
|
||||
ServerType.GameApi => ServerConfiguration.Instance.GameApiListenUrl,
|
||||
ServerType.Website => ServerConfiguration.Instance.WebsiteListenUrl,
|
||||
ServerType.Api => ServerConfiguration.Instance.ApiListenUrl,
|
||||
};
|
||||
|
||||
url = url.Replace("0.0.0.0", "127.0.0.1");
|
||||
|
||||
Logger.LogDebug("Warming up Hot Reload...", LogArea.Startup);
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Diagnostics;
|
|||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Logging.Loggers;
|
||||
using LBPUnion.ProjectLighthouse.Startup;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -17,6 +18,10 @@ public static class StartupTasks
|
|||
Stopwatch stopwatch = new();
|
||||
stopwatch.Start();
|
||||
|
||||
#if DEBUG
|
||||
DebugWarmupLifetime.ServerType = serverType;
|
||||
#endif
|
||||
|
||||
// Setup logging
|
||||
Logger.AddLogger(new ConsoleLogger());
|
||||
Logger.AddLogger(new LighthouseFileLogger());
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ServerConfiguration
|
|||
// You can use an ObsoleteAttribute instead. Make sure you set it to error, though.
|
||||
//
|
||||
// Thanks for listening~
|
||||
public const int CurrentConfigVersion = 1;
|
||||
public const int CurrentConfigVersion = 2;
|
||||
|
||||
#region Meta
|
||||
|
||||
|
@ -162,7 +162,13 @@ public class ServerConfiguration
|
|||
|
||||
#endregion
|
||||
|
||||
[Obsolete("Obsolete. Use the Website/GameApi/Api listen URLS instead.")]
|
||||
public string ListenUrl { get; set; } = "http://localhost:10060";
|
||||
|
||||
public string WebsiteListenUrl { get; set; } = "http://localhost:10060";
|
||||
public string GameApiListenUrl { get; set; } = "http://localhost:10061";
|
||||
public string ApiListenUrl { get; set; } = "http://localhost:10062";
|
||||
|
||||
public string DbConnectionString { get; set; } = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||
public string ExternalUrl { get; set; } = "http://localhost:10060";
|
||||
public bool ConfigReloading { get; set; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue