This commit is contained in:
Jamie Rees 2016-03-16 22:12:15 +00:00
parent de84f0f191
commit 601a377d97
3 changed files with 35 additions and 28 deletions

View file

@ -59,20 +59,25 @@ namespace PlexRequests.UI
Console.ReadLine();
Environment.Exit(1);
}
uri = $"http://localhost:{portResult}";
uri = $"http://*:{portResult}";
}
Log.Trace("Getting product version");
WriteOutVersion();
var s = new Setup();
s.SetupDb();
if(string.IsNullOrEmpty(uri))
if (string.IsNullOrEmpty(uri))
uri = GetStartupUri();
StartOptions options = new StartOptions();
var newPort = GetPort();
options.Urls.Add($"http://*:{newPort}");
;
var options = new StartOptions(uri)
{
ServerFactory = "Microsoft.Owin.Host.HttpListener"
};
try
{
using (WebApp.Start<Startup>(options))
{
@ -80,6 +85,13 @@ var newPort = GetPort();
Console.WriteLine("Press any key to exit");
Console.ReadLine();
}
}
catch (Exception e)
{
var a = e.Message;
throw;
}
}
private static void WriteOutVersion()
@ -92,28 +104,18 @@ var newPort = GetPort();
private static string GetStartupUri()
{
Log.Trace("Getting startup URI");
var uri = "http://localhost:3579/";
var uri = "http://*:3579/";
var service = new SettingsServiceV2<PlexRequestSettings>(new JsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var settings = service.GetSettings();
Log.Trace("Port: {0}", settings.Port);
if (settings.Port != 0)
{
uri = $"http://localhost:{settings.Port}";
uri = $"http://*:{settings.Port}";
}
return uri;
}
private static int GetPort()
{
var service = new SettingsServiceV2<PlexRequestSettings>(new JsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var settings = service.GetSettings();
return settings.Port;
}
private static void ConfigureTargets(string connectionString)
{
LogManager.ThrowExceptions = true;
@ -159,7 +161,7 @@ private static int GetPort()
// Step 5. Activate the configuration
LogManager.Configuration = config;
}
catch (Exception )
catch (Exception)
{
throw;