Created
December 30, 2022 14:36
-
-
Save manoj-choudhari-git/1322ccd00d1565ca88b997dba48b59a7 to your computer and use it in GitHub Desktop.
Demo - Azure App Configuration - API Method to read the settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("api/[controller]")] | |
[ApiController] | |
public class SettingsController : ControllerBase | |
{ | |
private readonly IConfiguration _configuration; | |
public SettingsController(IConfiguration configuration) | |
{ | |
this._configuration = configuration; | |
} | |
[HttpGet] | |
public IActionResult GetSettings() | |
{ | |
var logLevel = _configuration["TestApi:LogLevel"]; | |
var apiEndpointUrl = _configuration["TestApi:ApiEndpointUrl"]; | |
var result = $"logLevel={logLevel}, apiEndpointUrl={apiEndpointUrl}"; | |
return Ok(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment