|
|
|
@ -23,11 +23,13 @@ namespace Ombi
|
|
|
|
|
|
|
|
|
|
var host = string.Empty;
|
|
|
|
|
var storagePath = string.Empty;
|
|
|
|
|
var baseUrl = string.Empty;
|
|
|
|
|
var result = Parser.Default.ParseArguments<Options>(args)
|
|
|
|
|
.WithParsed(o =>
|
|
|
|
|
{
|
|
|
|
|
host = o.Host;
|
|
|
|
|
storagePath = o.StoragePath;
|
|
|
|
|
baseUrl = o.BaseUrl;
|
|
|
|
|
}).WithNotParsed(err =>
|
|
|
|
|
{
|
|
|
|
|
foreach (var e in err)
|
|
|
|
@ -47,6 +49,7 @@ namespace Ombi
|
|
|
|
|
{
|
|
|
|
|
var config = ctx.ApplicationConfigurations.ToList();
|
|
|
|
|
var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url);
|
|
|
|
|
var dbBaseUrl = config.FirstOrDefault(x => x.Type == ConfigurationTypes.BaseUrl);
|
|
|
|
|
if (url == null)
|
|
|
|
|
{
|
|
|
|
|
url = new ApplicationConfiguration
|
|
|
|
@ -65,6 +68,25 @@ namespace Ombi
|
|
|
|
|
ctx.SaveChanges();
|
|
|
|
|
urlValue = url.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dbBaseUrl == null)
|
|
|
|
|
{
|
|
|
|
|
if (baseUrl.HasValue() && baseUrl.StartsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
dbBaseUrl = new ApplicationConfiguration
|
|
|
|
|
{
|
|
|
|
|
Type = ConfigurationTypes.BaseUrl,
|
|
|
|
|
Value = baseUrl
|
|
|
|
|
};
|
|
|
|
|
ctx.ApplicationConfigurations.Add(dbBaseUrl);
|
|
|
|
|
ctx.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(!baseUrl.Equals(dbBaseUrl.Value))
|
|
|
|
|
{
|
|
|
|
|
dbBaseUrl.Value = baseUrl;
|
|
|
|
|
ctx.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeleteSchedulesDb();
|
|
|
|
@ -118,5 +140,8 @@ namespace Ombi
|
|
|
|
|
[Option("storage", Required = false, HelpText = "Storage path, where we save the logs and database")]
|
|
|
|
|
public string StoragePath { get; set; }
|
|
|
|
|
|
|
|
|
|
[Option("baseurl", Required = false, HelpText = "The base URL for reverse proxy scenarios")]
|
|
|
|
|
public string BaseUrl { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|