Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created December 30, 2022 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/1322ccd00d1565ca88b997dba48b59a7 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/1322ccd00d1565ca88b997dba48b59a7 to your computer and use it in GitHub Desktop.
Demo - Azure App Configuration - API Method to read the settings
[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