32 lines
856 B
C#
32 lines
856 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Options;
|
|
using backend.Models;
|
|
|
|
namespace backend.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class ConfigController : ControllerBase
|
|
{
|
|
private readonly AppConfig _appConfig;
|
|
|
|
public ConfigController(IOptions<AppConfig> appConfig)
|
|
{
|
|
_appConfig = appConfig.Value;
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult GetConfig()
|
|
{
|
|
return Ok(new
|
|
{
|
|
siteTitle = _appConfig.SiteTitle,
|
|
subtitle = _appConfig.Subtitle,
|
|
channels = _appConfig.Channels.Select(c => new { name = c.Name, url = c.Url }),
|
|
shortText = _appConfig.ShortText,
|
|
quizParticipationPoints = _appConfig.Quiz.ParticipationPoints,
|
|
quizCorrectAnswerPoints = _appConfig.Quiz.CorrectAnswerPoints
|
|
});
|
|
}
|
|
}
|