mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
add ListenIP config option for asset server
This commit is contained in:
parent
56c388b1d6
commit
b7720af330
@ -1,6 +1,7 @@
|
||||
namespace sodoff.Configuration;
|
||||
public class AssetServerConfig {
|
||||
public bool Enabled { get; set; } = false;
|
||||
public string ListenIP { get; set; } = string.Empty;
|
||||
public int Port { get; set; } = 5001;
|
||||
public string URLPrefix { get; set; } = string.Empty;
|
||||
public AssetServerMode Mode { get; set; }
|
||||
|
@ -6,6 +6,7 @@ using sodoff.Model;
|
||||
using sodoff.Services;
|
||||
using sodoff.Utils;
|
||||
using System.Xml;
|
||||
using System.Net;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@ -33,10 +34,14 @@ builder.Services.AddScoped<AchievementService>();
|
||||
builder.Services.AddScoped<GameDataService>();
|
||||
|
||||
bool assetServer = builder.Configuration.GetSection("AssetServer").GetValue<bool>("Enabled");
|
||||
string assetIP = builder.Configuration.GetSection("AssetServer").GetValue<string>("ListenIP");
|
||||
int assetPort = builder.Configuration.GetSection("AssetServer").GetValue<int>("Port");
|
||||
if (assetServer)
|
||||
builder.Services.Configure<KestrelServerOptions>(options => {
|
||||
options.ListenAnyIP(assetPort);
|
||||
if (String.IsNullOrEmpty(assetIP) || assetIP == "*")
|
||||
options.ListenAnyIP(assetPort);
|
||||
else
|
||||
options.Listen(IPAddress.Parse(assetIP), assetPort);
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user