You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using HttpClientStudy.Config;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace HttpClientStudy.WebApp.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 使用配置文件 控制器
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class ConfigController : ControllerBase
|
|
{
|
|
private ILogger<SimpleController> _logger;
|
|
private IOptionsMonitor<WebApiConfig> _apiConfigMonitor;
|
|
|
|
/// <summary>
|
|
/// 构造
|
|
/// </summary>
|
|
public ConfigController(ILogger<SimpleController> logger, IOptionsMonitor<WebApiConfig> apiConfigMonitor)
|
|
{
|
|
_logger = logger;
|
|
_apiConfigMonitor = apiConfigMonitor;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取账号
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public IActionResult GetApiConfig()
|
|
{
|
|
var reslut = BaseResultUtil.Success(_apiConfigMonitor.CurrentValue);
|
|
return Ok(reslut);
|
|
}
|
|
}
|
|
}
|