mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 14:10:50 -07:00
Exploratory test for #37
This commit is contained in:
parent
76808adba2
commit
2786d13a17
1 changed files with 13 additions and 11 deletions
|
@ -48,7 +48,7 @@ namespace PlexRequests.UI
|
||||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var uri = string.Empty;
|
var port = -1;
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
Log.Info("We are going to use port {0} that was passed in", args[0]);
|
Log.Info("We are going to use port {0} that was passed in", args[0]);
|
||||||
|
@ -59,7 +59,7 @@ namespace PlexRequests.UI
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
uri = $"http://*:{portResult}";
|
port = portResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Trace("Getting product version");
|
Log.Trace("Getting product version");
|
||||||
|
@ -68,19 +68,21 @@ namespace PlexRequests.UI
|
||||||
var s = new Setup();
|
var s = new Setup();
|
||||||
s.SetupDb();
|
s.SetupDb();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(uri))
|
if (port == -1)
|
||||||
uri = GetStartupUri();
|
port = GetStartupPort();
|
||||||
|
|
||||||
var options = new StartOptions(uri)
|
var options = new StartOptions
|
||||||
{
|
{
|
||||||
ServerFactory = "Microsoft.Owin.Host.HttpListener"
|
ServerFactory = "Microsoft.Owin.Host.HttpListener"
|
||||||
};
|
};
|
||||||
|
options.Urls.Add($"http://localhost:{port}");
|
||||||
|
//options.Urls.Add($"http://127.0.0.1:{port}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
using (WebApp.Start<Startup>(options))
|
using (WebApp.Start<Startup>(options))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Request Plex is running on {uri}");
|
Console.WriteLine($"Request Plex is running on the following port: {port}");
|
||||||
Console.WriteLine("Press any key to exit");
|
Console.WriteLine("Press any key to exit");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
|
@ -100,19 +102,19 @@ namespace PlexRequests.UI
|
||||||
Console.WriteLine($"Version: {assemblyVer}");
|
Console.WriteLine($"Version: {assemblyVer}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetStartupUri()
|
private static int GetStartupPort()
|
||||||
{
|
{
|
||||||
Log.Trace("Getting startup URI");
|
Log.Trace("Getting startup Port");
|
||||||
var uri = "http://*:3579/";
|
var port = 3579;
|
||||||
var service = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
|
var service = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
|
||||||
var settings = service.GetSettings();
|
var settings = service.GetSettings();
|
||||||
Log.Trace("Port: {0}", settings.Port);
|
Log.Trace("Port: {0}", settings.Port);
|
||||||
if (settings.Port != 0)
|
if (settings.Port != 0)
|
||||||
{
|
{
|
||||||
uri = $"http://*:{settings.Port}";
|
port = settings.Port;
|
||||||
}
|
}
|
||||||
|
|
||||||
return uri;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureTargets(string connectionString)
|
private static void ConfigureTargets(string connectionString)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue