Added the ability to automatically generate the API Key on startup if it does not exist #2070

pull/2096/head
tidusjar 7 years ago
parent a8f906617a
commit f1e164d29a

@ -165,6 +165,12 @@ namespace Ombi
var ombiService = var ombiService =
app.ApplicationServices.GetService<ISettingsService<OmbiSettings>>(); app.ApplicationServices.GetService<ISettingsService<OmbiSettings>>();
var settings = ombiService.GetSettings(); var settings = ombiService.GetSettings();
if (settings.ApiKey.IsNullOrEmpty())
{
// Generate a API Key
settings.ApiKey = Guid.NewGuid().ToString("N");
ombiService.SaveSettings(settings);
}
if (settings.BaseUrl.HasValue()) if (settings.BaseUrl.HasValue())
{ {
app.UsePathBase(settings.BaseUrl); app.UsePathBase(settings.BaseUrl);

Loading…
Cancel
Save