Commit 63b8b888 authored by tidusjar's avatar tidusjar

Output some useful stuff to the about window regarding the databases

parent f4933bfc
......@@ -192,6 +192,13 @@ export interface IAbout {
osDescription: string;
processArchitecture: string;
applicationBasePath: string;
ombiDatabaseType: string;
externalDatabaseType: string;
settingsDatabaseType: string;
ombiConnectionString: string;
externalConnectionString: string;
settingsConnectionString: string;
storagePath: string;
}
export interface ICouchPotatoSettings extends IExternalSettings {
......
......@@ -98,6 +98,44 @@
<span>{{about.applicationBasePath}}</span>
</td>
</tr>
<tr>
<td>
<span>Storage Path</span>
</td>
<td>
<span>{{about.storagePath}}</span>
</td>
</tr>
<tr>
<td>
<span>Ombi Database</span>
</td>
<td>
<span>{{about.ombiDatabaseType}} - {{about.ombiConnectionString}}</span>
</td>
</tr>
<tr>
<td>
<span>External Database</span>
</td>
<td>
<span>{{about.externalDatabaseType}} - {{about.externalConnectionString}}</span>
</td>
</tr>
<tr>
<td>
<span>Settings Database</span>
</td>
<td>
<span>{{about.settingsDatabaseType}} - {{about.settingsConnectionString}}</span>
</td>
</tr>
</tbody>
</table>
</div>
......
......@@ -27,6 +27,7 @@ using Ombi.Store.Entities;
using Ombi.Store.Repository;
using Ombi.Api.Github;
using Ombi.Core.Engine;
using Ombi.Extensions;
using Ombi.Schedule;
using Quartz;
......@@ -93,15 +94,25 @@ namespace Ombi.Controllers
[HttpGet("about")]
public AboutViewModel About()
{
var dbConfiguration = DatabaseExtensions.GetDatabaseConfiguration();
var storage = StoragePathSingleton.Instance;
var model = new AboutViewModel
{
FrameworkDescription = RuntimeInformation.FrameworkDescription,
OsArchitecture = RuntimeInformation.OSArchitecture.ToString(),
OsDescription = RuntimeInformation.OSDescription,
ProcessArchitecture = RuntimeInformation.ProcessArchitecture.ToString(),
ApplicationBasePath =Directory.GetCurrentDirectory()
ApplicationBasePath = Directory.GetCurrentDirectory(),
ExternalConnectionString = dbConfiguration.ExternalDatabase.ConnectionString,
ExternalDatabaseType = dbConfiguration.ExternalDatabase.Type,
OmbiConnectionString = dbConfiguration.OmbiDatabase.ConnectionString,
OmbiDatabaseType = dbConfiguration.OmbiDatabase.Type,
SettingsConnectionString = dbConfiguration.SettingsDatabase.ConnectionString,
SettingsDatabaseType = dbConfiguration.SettingsDatabase.Type,
StoragePath = storage.StoragePath.HasValue() ? storage.StoragePath : "None Specified"
};
var version = AssemblyHelper.GetRuntimeVersion();
var productArray = version.Split('-');
model.Version = productArray[0];
......@@ -233,8 +244,8 @@ namespace Ombi.Controllers
[AllowAnonymous]
public async Task<string> GetDefaultLanguage()
{
var s = await Get<OmbiSettings>();
return s.DefaultLanguageCode;
var s = await Get<OmbiSettings>();
return s.DefaultLanguageCode;
}
/// <summary>
......@@ -431,7 +442,7 @@ namespace Ombi.Controllers
[HttpGet("Update")]
public async Task<UpdateSettings> UpdateSettings()
{
var settings = await Get<UpdateSettings>();
var settings = await Get<UpdateSettings>();
return Mapper.Map<UpdateSettingsViewModel>(settings);
}
......@@ -586,7 +597,7 @@ namespace Ombi.Controllers
Message = $"CRON Expression {body.Expression} is not valid"
};
}
model.Success = true;
return model;
}
......
......@@ -19,14 +19,7 @@ namespace Ombi.Extensions
public static void ConfigureDatabases(this IServiceCollection services)
{
var i = StoragePathSingleton.Instance;
if (string.IsNullOrEmpty(i.StoragePath))
{
i.StoragePath = string.Empty;
}
var databaseFileLocation = Path.Combine(i.StoragePath, "database.json");
var configuration = GetDatabaseConfiguration(databaseFileLocation, i.StoragePath);
var configuration = GetDatabaseConfiguration();
// Ombi db
switch (configuration.OmbiDatabase.Type)
......@@ -60,9 +53,17 @@ namespace Ombi.Extensions
}
}
public static DatabaseConfiguration GetDatabaseConfiguration(string databaseFileLocation, string storagePath)
public static DatabaseConfiguration GetDatabaseConfiguration()
{
var configuration = new DatabaseConfiguration(storagePath);
var i = StoragePathSingleton.Instance;
if (string.IsNullOrEmpty(i.StoragePath))
{
i.StoragePath = string.Empty;
}
var databaseFileLocation = Path.Combine(i.StoragePath, "database.json");
var configuration = new DatabaseConfiguration(i.StoragePath);
if (File.Exists(databaseFileLocation))
{
var databaseJson = File.ReadAllText(databaseFileLocation);
......@@ -94,7 +95,7 @@ namespace Ombi.Extensions
{
public DatabaseConfiguration()
{
}
public DatabaseConfiguration(string defaultSqlitePath)
......@@ -119,7 +120,7 @@ namespace Ombi.Extensions
// Used in Deserialization
public PerDatabaseConfiguration()
{
}
public string Type { get; set; }
public string ConnectionString { get; set; }
......
......@@ -9,5 +9,12 @@
public string OsDescription { get; set; }
public string ProcessArchitecture { get; set; }
public string ApplicationBasePath { get; set; }
public string OmbiDatabaseType { get; set; }
public string ExternalDatabaseType { get; set; }
public string SettingsDatabaseType { get; set; }
public string OmbiConnectionString { get; set; }
public string ExternalConnectionString { get; set; }
public string SettingsConnectionString { get; set; }
public string StoragePath { get; set; }
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment