Skip to content

Commit

Permalink
Merge pull request #130 from ArttuKuikka/Dev
Browse files Browse the repository at this point in the history
App config
  • Loading branch information
ArttuKuikka authored Dec 26, 2024
2 parents ded6219 + 8e722df commit 4fd412f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Controllers/AppController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using RuokalistaServer.Models;

namespace RuokalistaServer.Controllers
{
public class AppController : Controller
{
[HttpGet]
[Route("api/v1/App/Config")]
public IActionResult Config()
{
var config = new AppConfig
{
Branding = GlobalConfig.BrandingName,
PrimaryColor = GlobalConfig.PrimaryColor,
KasvisruokalistaEnabled = GlobalConfig.KasvisruokalistaEnabled,
AanestysEnabled = GlobalConfig.AanestysEnabled,
DefaultLanguage = GlobalConfig.DefaultLanguage
};
return Json(config);
}
}
}
2 changes: 2 additions & 0 deletions src/GlobalConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public static class GlobalConfig
public static string BrandingName = Environment.GetEnvironmentVariable("Branding") ?? "Kouluruokalista.fi";

public static string? StaticContentHost = Environment.GetEnvironmentVariable("StaticContentHost");

public static string DefaultLanguage = Environment.GetEnvironmentVariable("DefaultLanguage") ?? "fin";
}
}
12 changes: 12 additions & 0 deletions src/Models/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace RuokalistaServer.Models
{
public class AppConfig
{
public string Branding { get; set; }
public string PrimaryColor { get; set; }
public bool KasvisruokalistaEnabled { get; set; }
public bool AanestysEnabled { get; set; }
public string DefaultLanguage { get; set; }

}
}

0 comments on commit 4fd412f

Please sign in to comment.