Add server configuration service and repo
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RecNet.Application.Services.Configuration;
|
||||
|
||||
namespace API.Controllers.Config.V1;
|
||||
|
||||
[Route("api/[controller]/v1")]
|
||||
[ApiController]
|
||||
public class ConfigController : ControllerBase
|
||||
public class ConfigController(IConfigService configService) : ControllerBase
|
||||
{
|
||||
// TODO: Resolve from Database
|
||||
[HttpGet("motd")]
|
||||
public ActionResult<string> GetMotd()
|
||||
=> Ok("Hello World!");
|
||||
public async Task<ActionResult<string>> GetMotd(CancellationToken ct = default)
|
||||
{
|
||||
var motd = await configService.GetAsync("Config:MOTD", "Ten Whole Years!", ct);
|
||||
|
||||
return Ok(motd);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user