improved the config in the diagnose
This commit is contained in:
@@ -9,6 +9,8 @@ namespace Moonlight.ApiServer.Implementations.Diagnose;
|
|||||||
|
|
||||||
public class CoreDiagnoseProvider : IDiagnoseProvider
|
public class CoreDiagnoseProvider : IDiagnoseProvider
|
||||||
{
|
{
|
||||||
|
private readonly AppConfiguration Config;
|
||||||
|
|
||||||
public DiagnoseEntry[] GetFiles()
|
public DiagnoseEntry[] GetFiles()
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
@@ -29,19 +31,17 @@ public class CoreDiagnoseProvider : IDiagnoseProvider
|
|||||||
|
|
||||||
new DiagnoseFile()
|
new DiagnoseFile()
|
||||||
{
|
{
|
||||||
Name = "logs.txt",
|
Name = "config.txt",
|
||||||
GetContent = () =>
|
GetContent = () =>
|
||||||
{
|
{
|
||||||
|
var json = JsonSerializer.Serialize(Config);
|
||||||
var configJson = File.ReadAllText(PathBuilder.File("storage", "app.json"));
|
var config = JsonSerializer.Deserialize<AppConfiguration>(json);
|
||||||
|
|
||||||
var config = JsonSerializer.Deserialize<AppConfiguration>(configJson);
|
|
||||||
|
|
||||||
if (config == null)
|
if (config == null)
|
||||||
{
|
{
|
||||||
return Encoding.UTF8.GetBytes("could not fetch config");
|
return Encoding.UTF8.GetBytes("Could not fetch config.");
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Database.Password = CheckForNullOrEmpty(config.Database.Password);
|
config.Database.Password = CheckForNullOrEmpty(config.Database.Password);
|
||||||
|
|
||||||
config.Authentication.OAuth2.ClientSecret = CheckForNullOrEmpty(config.Authentication.OAuth2.ClientSecret);
|
config.Authentication.OAuth2.ClientSecret = CheckForNullOrEmpty(config.Authentication.OAuth2.ClientSecret);
|
||||||
@@ -50,7 +50,7 @@ public class CoreDiagnoseProvider : IDiagnoseProvider
|
|||||||
|
|
||||||
config.Authentication.Secret = CheckForNullOrEmpty(config.Authentication.Secret);
|
config.Authentication.Secret = CheckForNullOrEmpty(config.Authentication.Secret);
|
||||||
|
|
||||||
return Encoding.UTF8.GetBytes(JsonSerializer.Serialize(config));
|
return Encoding.UTF8.GetBytes(JsonSerializer.Serialize(config, new JsonSerializerOptions() { WriteIndented = true}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user