aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core/API/Controllers/OptionsController.cs
diff options
context:
space:
mode:
authorLev Gorodetskiy <github@droserasprout.space>2022-09-02 17:50:01 -0300
committerLev Gorodetskiy <github@droserasprout.space>2022-09-02 17:50:01 -0300
commit200bddf616946ab625d31564fc931f48915702e3 (patch)
tree7d720573ff244352c2aee09135cc4b7751e8a495 /src/slskd/Core/API/Controllers/OptionsController.cs
parent3c4ce3c0ee5a178dd14fab06575acca39a36c6b2 (diff)
parentb2611b3e94b11853f576cffce371f9ed264d4841 (diff)
downloadslskd-200bddf616946ab625d31564fc931f48915702e3.tar.gz
Merge branch 'master' into aux/docs-proofreading
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")]