pull/2052/head
Jamie 7 years ago
parent 03b35e645c
commit 687bd53bcb

@ -247,24 +247,16 @@ namespace Ombi.Schedule.Jobs.Ombi
sb.Append($"--windowsServiceName \"{settings.WindowsServiceName}\" "); sb.Append($"--windowsServiceName \"{settings.WindowsServiceName}\" ");
} }
var sb2 = new StringBuilder(); var sb2 = new StringBuilder();
var hasStartupArgs = false;
if (url?.Value.HasValue() ?? false) if (url?.Value.HasValue() ?? false)
{ {
hasStartupArgs = true; sb2.Append($" --host {url.Value}");
sb2.Append(url.Value);
} }
if (storage?.Value.HasValue() ?? false) if (storage?.Value.HasValue() ?? false)
{ {
hasStartupArgs = true; sb2.Append($" --storage {storage.Value}");
sb2.Append(storage.Value);
}
if (hasStartupArgs)
{
sb.Append($"--startupArgs {sb2.ToString()}");
} }
return sb.ToString(); return sb.ToString();
//return string.Join(" ", currentLocation, processName, url?.Value ?? string.Empty, storage?.Value ?? string.Empty);
} }
private void RunScript(UpdateSettings settings, string downloadUrl) private void RunScript(UpdateSettings settings, string downloadUrl)

@ -3,6 +3,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Threading; using System.Threading;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -78,12 +79,22 @@ namespace Ombi.Updater
} }
else 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 var start = new ProcessStartInfo
{ {
UseShellExecute = false, UseShellExecute = false,
FileName = Path.Combine(options.ApplicationPath, fileName), FileName = Path.Combine(options.ApplicationPath, fileName),
WorkingDirectory = options.ApplicationPath, WorkingDirectory = options.ApplicationPath,
Arguments = options.StartupArgs Arguments = startupArgsBuilder.ToString()
}; };
using (var proc = new Process { StartInfo = start }) using (var proc = new Process { StartInfo = start })
{ {

@ -78,8 +78,10 @@ namespace Ombi.Updater
public string ApplicationPath { get; set; } public string ApplicationPath { get; set; }
[Option("processId", Required = false)] [Option("processId", Required = false)]
public int OmbiProcessId { get; set; } public int OmbiProcessId { get; set; }
[Option("startupArgs", Required = false)] [Option("host", Required = false)]
public string StartupArgs { get; set; } public string Host { get; set; }
[Option("storage", Required = false)]
public string Storage { get; set; }
[Option("windowsServiceName", Required = false)] [Option("windowsServiceName", Required = false)]
public string WindowsServiceName { get; set; } public string WindowsServiceName { get; set; }

@ -52,7 +52,7 @@ namespace Ombi
url = new ApplicationConfiguration url = new ApplicationConfiguration
{ {
Type = ConfigurationTypes.Url, Type = ConfigurationTypes.Url,
Value = "http://*" Value = "http://*:5000"
}; };
ctx.ApplicationConfigurations.Add(url); ctx.ApplicationConfigurations.Add(url);
@ -93,13 +93,13 @@ namespace Ombi
public class Options 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." + "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). " + " 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")] "The protocol (http:// or https://) must be included with each URL. Supported formats vary between servers.", Default = "http://*:5000")]
public string Host { get; set; } 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; } public string StoragePath { get; set; }
} }

Loading…
Cancel
Save