mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-08-11 09:13:42 -04:00
Fixing docker bind issue (#1852)
# Fixed: - Fixed an issue for docker users conflicting with a previous feature inclusion for multiple IP addresses
This commit is contained in:
parent
c07f174baf
commit
4c837170d7
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO.Abstractions;
|
using System.IO.Abstractions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
@ -10,6 +10,7 @@ using API.Logging;
|
|||||||
using API.Services;
|
using API.Services;
|
||||||
using API.SignalR;
|
using API.SignalR;
|
||||||
using Kavita.Common;
|
using Kavita.Common;
|
||||||
|
using Kavita.Common.EnvironmentInfo;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
@ -172,27 +173,27 @@ public class Program
|
|||||||
webBuilder.UseKestrel((opts) =>
|
webBuilder.UseKestrel((opts) =>
|
||||||
{
|
{
|
||||||
var ipAddresses = Configuration.IpAddresses;
|
var ipAddresses = Configuration.IpAddresses;
|
||||||
if (string.IsNullOrEmpty(ipAddresses))
|
if (new OsInfo(Array.Empty<IOsVersionAdapter>()).IsDocker || string.IsNullOrEmpty(ipAddresses))
|
||||||
{
|
{
|
||||||
opts.ListenAnyIP(HttpPort, options => { options.Protocols = HttpProtocols.Http1AndHttp2; });
|
opts.ListenAnyIP(HttpPort, options => { options.Protocols = HttpProtocols.Http1AndHttp2; });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach(var ipAddress in ipAddresses.Split(','))
|
foreach (var ipAddress in ipAddresses.Split(','))
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
var address = System.Net.IPAddress.Parse(ipAddress.Trim());
|
var address = System.Net.IPAddress.Parse(ipAddress.Trim());
|
||||||
opts.Listen(address, HttpPort, options => { options.Protocols = HttpProtocols.Http1AndHttp2; });
|
opts.Listen(address, HttpPort, options => { options.Protocols = HttpProtocols.Http1AndHttp2; });
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Fatal(ex, "Could not parse ip addess '{0}'", ipAddress);
|
Log.Fatal(ex, "Could not parse ip address {IPAddress}", ipAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user