Compare commits

..

2 Commits

Author SHA1 Message Date
b361f46afa Read admin password from env var in production 2026-03-04 00:09:19 +02:00
109cbb29e2 Update about page 2026-03-04 00:09:02 +02:00
6 changed files with 36 additions and 12 deletions

View File

@@ -25,6 +25,13 @@ public class Program
var authOptions = builder.Configuration.GetSection("Auth").Get<AuthOptions>()
?? throw new InvalidOperationException("Auth configuration was not found.");
if (builder.Environment.IsProduction())
{
authOptions.Admin.Password =
Environment.GetEnvironmentVariable("KLAPI_ADMIN_PASSWORD")
?? throw new InvalidOperationException("Admin password must be set in production environment using KLAPI_ADMIN_PASSWORD environment variable.");
}
if (string.IsNullOrWhiteSpace(authOptions.SigningKey) || authOptions.SigningKey.Length < 32)
{
throw new InvalidOperationException("Auth:SigningKey must be at least 32 characters long.");

View File

@@ -12,15 +12,10 @@
"Issuer": "klapi-api",
"Audience": "klapi-ui",
"SigningKey": "change-this-to-a-long-random-32-char-minimum-key",
"AllowedOrigins": [
"http://localhost:5173",
"http://127.0.0.1:5173",
"http://localhost:4173",
"http://127.0.0.1:4173"
],
"AllowedOrigins": ["https://klapi.tietokonepaja.fi"],
"Admin": {
"Username": "admin",
"Password": "changeme",
"Password": "<set in env var KLAPI_ADMIN_PASSWORD>",
"DisplayName": "Administrator"
}
},

Binary file not shown.

View File

@@ -15,10 +15,11 @@ const translations = {
"nav.language.en": "EN",
"meta.description": "React + Recoil example",
"home.title": "Home",
"home.heading": "KlAPI",
"home.heading": "Klapi",
"home.subheading": "Livonsaaren Tietokonepaja's administration console",
"home.signedInAs": "You are signed in as",
"home.logoAlt": "logo",
"home.openHours.heading": "Open hours versions",
"home.openHours.heading": "Open hours of Livonsaaren Osuuskauppa",
"home.openHours.latest": "Latest",
"home.openHours.new": "New version",
"home.openHours.edit": "Edit",
@@ -43,6 +44,9 @@ const translations = {
"home.openHours.updated": "Version updated",
"home.openHours.deleted": "Version deleted",
"about.title": "About",
"about.description":
"Livonsaaren Tietokonepaja is a local project providing IT services for our dear archipelago.",
"about.bugReportsPrefix": "All bug reports can be sent to",
"about.apiVersion": "API version",
"about.loading": "Loading...",
"login.title": "Klapi",
@@ -92,9 +96,10 @@ const translations = {
"meta.description": "React + Recoil -esimerkki",
"home.title": "Etusivu",
"home.heading": "Klapi",
"home.subheading": "Livonsaaren Tietokonepajan hallintakonsoli",
"home.signedInAs": "Olet kirjautunut käyttäjänä",
"home.logoAlt": "logo",
"home.openHours.heading": "Aukioloaikaversiot",
"home.openHours.heading": "Livonsaaren osuuskaupan aukioloaika",
"home.openHours.latest": "Viimeisin",
"home.openHours.new": "Uusi versio",
"home.openHours.edit": "Muokkaa",
@@ -119,6 +124,9 @@ const translations = {
"home.openHours.updated": "Versio päivitetty",
"home.openHours.deleted": "Versio poistettu",
"about.title": "Tietoja",
"about.description":
"Livonsaaren Tietokonepaja on paikallisprojekti, joka tuottaa IT-palveluita rakkaalle lähisaaristollemme.",
"about.bugReportsPrefix": "Kaikki bugiraportit voi lähettää osoitteeseen",
"about.apiVersion": "API-versio",
"about.loading": "Ladataan...",
"login.title": "Klapi",

View File

@@ -31,8 +31,21 @@ export default function About() {
}, []);
return (
<main>
<p className="text-center text-[#70421E]">
<main className="space-y-4 px-4">
<p className="mx-auto max-w-md text-center text-lg font-semibold text-[#70421E]">
{t("about.description")}
</p>
<p className="mx-auto max-w-md text-center text-sm text-[#70421E]/90">
{t("about.bugReportsPrefix")} {" "}
<a
href="mailto:info@tietokonepaja.fi"
className="font-medium underline underline-offset-2 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current"
>
info@tietokonepaja.fi
</a>
.
</p>
<p className="mx-auto max-w-md text-center text-xs uppercase tracking-wide text-[#70421E]/80">
{t("about.apiVersion")}: {apiVersion ?? t("about.loading")}
</p>
</main>

View File

@@ -12,6 +12,7 @@ export default function Home() {
return (
<main>
<h1 className="text-center">{t("home.heading")}</h1>
<h2 className="text-center">{t("home.subheading")}</h2>
<img src="/favicon.svg" alt={t("home.logoAlt")} className="w-28" />
<OpenHoursForm />
</main>