From 687bd53bcb3d4f837edf6005d53a88ea578fe446 Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 20 Feb 2018 08:12:11 +0000 Subject: [PATCH] Fixed #1989 #1719 --- src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs | 12 ++---------- src/Ombi.Updater/Installer.cs | 13 ++++++++++++- src/Ombi.Updater/Program.cs | 6 ++++-- src/Ombi/Program.cs | 8 ++++---- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs index 42688376a..4dff892f4 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs @@ -247,24 +247,16 @@ namespace Ombi.Schedule.Jobs.Ombi sb.Append($"--windowsServiceName \"{settings.WindowsServiceName}\" "); } var sb2 = new StringBuilder(); - var hasStartupArgs = false; if (url?.Value.HasValue() ?? false) { - hasStartupArgs = true; - sb2.Append(url.Value); + sb2.Append($" --host {url.Value}"); } if (storage?.Value.HasValue() ?? false) { - hasStartupArgs = true; - sb2.Append(storage.Value); - } - if (hasStartupArgs) - { - sb.Append($"--startupArgs {sb2.ToString()}"); + sb2.Append($" --storage {storage.Value}"); } return sb.ToString(); - //return string.Join(" ", currentLocation, processName, url?.Value ?? string.Empty, storage?.Value ?? string.Empty); } private void RunScript(UpdateSettings settings, string downloadUrl) diff --git a/src/Ombi.Updater/Installer.cs b/src/Ombi.Updater/Installer.cs index 5a84ecde7..ab7f92ed4 100644 --- a/src/Ombi.Updater/Installer.cs +++ b/src/Ombi.Updater/Installer.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; +using System.Text; using System.Threading; using Microsoft.Extensions.Logging; @@ -78,12 +79,22 @@ namespace Ombi.Updater } else { + var startupArgsBuilder = new StringBuilder(); + if (!string.IsNullOrEmpty(options.Host)) + { + startupArgsBuilder.Append($"--host {options.Host} "); + } + if (!string.IsNullOrEmpty(options.Storage)) + { + startupArgsBuilder.Append($"--storage {options.Storage}"); + } + var start = new ProcessStartInfo { UseShellExecute = false, FileName = Path.Combine(options.ApplicationPath, fileName), WorkingDirectory = options.ApplicationPath, - Arguments = options.StartupArgs + Arguments = startupArgsBuilder.ToString() }; using (var proc = new Process { StartInfo = start }) { diff --git a/src/Ombi.Updater/Program.cs b/src/Ombi.Updater/Program.cs index 26a1d180f..8cbaabb03 100644 --- a/src/Ombi.Updater/Program.cs +++ b/src/Ombi.Updater/Program.cs @@ -78,8 +78,10 @@ namespace Ombi.Updater public string ApplicationPath { get; set; } [Option("processId", Required = false)] public int OmbiProcessId { get; set; } - [Option("startupArgs", Required = false)] - public string StartupArgs { get; set; } + [Option("host", Required = false)] + public string Host { get; set; } + [Option("storage", Required = false)] + public string Storage { get; set; } [Option("windowsServiceName", Required = false)] public string WindowsServiceName { get; set; } diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index 957948807..943301a4d 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -52,7 +52,7 @@ namespace Ombi url = new ApplicationConfiguration { Type = ConfigurationTypes.Url, - Value = "http://*" + Value = "http://*:5000" }; ctx.ApplicationConfigurations.Add(url); @@ -93,13 +93,13 @@ namespace Ombi public class Options { - [Option('h', "host", Required = false, HelpText = + [Option("host", Required = false, HelpText = "Set to a semicolon-separated (;) list of URL prefixes to which the server should respond. For example, http://localhost:123." + " Use \"*\" to indicate that the server should listen for requests on any IP address or hostname using the specified port and protocol (for example, http://*:5000). " + "The protocol (http:// or https://) must be included with each URL. Supported formats vary between servers.", Default = "http://*:5000")] public string Host { get; set; } - - [Option('s', "storage", Required = false, HelpText = "Storage path, where we save the logs and database")] + + [Option("storage", Required = false, HelpText = "Storage path, where we save the logs and database")] public string StoragePath { get; set; } }