Initial commit
Build and Push Docker Images / build (push) Successful in 29s

This commit is contained in:
2026-05-02 21:31:31 +03:00
commit fc2dd721e4
78 changed files with 5002 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
using Api.Settings;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace Api.Controllers
{
/// <summary>
/// Provides simple endpoints to expose Google related public keys used by
/// the frontend (for example Google Analytics tag id and Maps API key).
/// These endpoints return only public values safe to be exposed to clients.
/// </summary>
[ApiController]
[Route("api/[controller]")]
[EnableCors("FrontendOnly")]
public sealed class GoogleController : ControllerBase
{
private readonly GoogleSettings _googleSettings;
private readonly ILogger<GoogleController> _log;
public GoogleController(IOptions<GoogleSettings> options, ILogger<GoogleController> log)
{
_googleSettings = options.Value;
_log = log;
}
/// <summary>
/// Returns the Google Tag Manager ID used by the frontend for analytics and tracking.
/// </summary>
/// <returns>200 OK with the Tag Manager ID as a string.</returns>
[HttpGet("tagmanager")]
public async Task<IActionResult> GetTagManagerId(CancellationToken ct)
{
return Ok(_googleSettings.TagManagerId);
}
/// <summary>
/// Returns the Google Maps API key used by the frontend to load the
/// Maps JavaScript API. This key is expected to be restricted and
/// safe to expose for client-side usage.
/// </summary>
/// <returns>200 OK with the maps API key as a string.</returns>
[HttpGet("maps")]
public async Task<IActionResult> GetMapKey(CancellationToken ct)
{
return Ok(_googleSettings.MapKey);
}
}
}