aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core/API/Controllers/OptionsController.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-06-02 08:38:47 -0500
committerGitHub <noreply@github.com>2022-06-02 08:38:47 -0500
commit2bd24b38f046d9e7b37825db6af2756e43ba0dfc (patch)
treefd1f5b246cdc8597e4bc9176fd70bb6067bebfe9 /src/slskd/Core/API/Controllers/OptionsController.cs
parent1a6075b612dd5067eb4e8376ac9034050ad74477 (diff)
parent9e0013c0317adbaa007fce8dbea06928b1d159ef (diff)
downloadslskd-2bd24b38f046d9e7b37825db6af2756e43ba0dfc.tar.gz
Merge pull request #493 from slskd/shares
Add a 'Shares' tab to the 'System' page, along with a button to rescan shares
Diffstat (limited to 'src/slskd/Core/API/Controllers/OptionsController.cs')
-rw-r--r--src/slskd/Core/API/Controllers/OptionsController.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/slskd/Core/API/Controllers/OptionsController.cs b/src/slskd/Core/API/Controllers/OptionsController.cs
index 062de8f7..b0856ed3 100644
--- a/src/slskd/Core/API/Controllers/OptionsController.cs
+++ b/src/slskd/Core/API/Controllers/OptionsController.cs
@@ -21,8 +21,10 @@ namespace slskd.Core.API
{
using System;
using System.IO;
+ using System.Reflection;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+ using Microsoft.Extensions.Configuration;
using Serilog;
using slskd.Validation;
using IOFile = System.IO.File;
@@ -74,6 +76,24 @@ namespace slskd.Core.API
return Ok(OptionsAtStartup.Redact());
}
+ /// <summary>
+ /// Gets the debug view of the current application options.
+ /// </summary>
+ /// <returns></returns>
+ [HttpGet]
+ [Route("debug")]
+ [Authorize]
+ [ProducesResponseType(typeof(string), 200)]
+ public IActionResult Debug()
+ {
+ // retrieve the IConfigurationRoot instance with reflection to avoid
+ // exposing it as a public member of Program.
+ var property = typeof(Program).GetProperty("Configuration", BindingFlags.NonPublic | BindingFlags.Static);
+ var configurationRoot = (IConfigurationRoot)property.GetValue(null, null);
+
+ return Ok(configurationRoot.GetDebugView());
+ }
+
[HttpGet]
[Authorize]
[Route("yaml/location")]