diff options
| author | Lev Gorodetskiy <github@droserasprout.space> | 2022-09-02 17:50:01 -0300 |
|---|---|---|
| committer | Lev Gorodetskiy <github@droserasprout.space> | 2022-09-02 17:50:01 -0300 |
| commit | 200bddf616946ab625d31564fc931f48915702e3 (patch) | |
| tree | 7d720573ff244352c2aee09135cc4b7751e8a495 /src/slskd/Core/API/Controllers/OptionsController.cs | |
| parent | 3c4ce3c0ee5a178dd14fab06575acca39a36c6b2 (diff) | |
| parent | b2611b3e94b11853f576cffce371f9ed264d4841 (diff) | |
| download | slskd-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.cs | 20 |
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")] |
