Fix Docker deployment and runtime environment variables

- Add --break-system-packages flag to pip install for Alpine Linux 3.12+ compatibility
- Configure Astro server to bind to 0.0.0.0 for Docker container accessibility
- Replace import.meta.env with process.env for runtime environment variable access in SSR
- Enable dynamic LOGIN configuration at runtime

Co-Authored-By: Warp <agent@warp.dev>
This commit is contained in:
root
2025-12-22 12:41:22 +01:00
parent 4fd9d3f400
commit eb32dd1064
11 changed files with 19 additions and 17 deletions

View File

@@ -14,7 +14,7 @@ const translations: Record<string, Translations> = {
*/
export function getLocale(astro: AstroGlobal): string {
// Check environment variable first (for Docker/container environments)
const envLocale = import.meta.env.LOCALE;
const envLocale = process.env.LOCALE;
if (envLocale && (envLocale === 'de' || envLocale === 'en')) {
return envLocale;
}
@@ -26,7 +26,7 @@ export function getLocale(astro: AstroGlobal): string {
*/
export function getLocaleFromRequest(request: Request): string {
// Check environment variable first (for Docker/container environments)
const envLocale = import.meta.env.LOCALE;
const envLocale = process.env.LOCALE;
if (envLocale && (envLocale === 'de' || envLocale === 'en')) {
return envLocale;
}

View File

@@ -1,7 +1,7 @@
import type { Request } from 'astro';
const SESSION_COOKIE = 'session';
const SESSION_SECRET = import.meta.env.SESSION_SECRET || 'default-secret-change-in-production';
const SESSION_SECRET = process.env.SESSION_SECRET || 'default-secret-change-in-production';
export interface Session {
username: string;
@@ -13,7 +13,7 @@ export interface Session {
* Wenn LOGIN=false oder nicht gesetzt, ist Login deaktiviert
*/
export function isLoginEnabled(): boolean {
const loginEnabled = import.meta.env.LOGIN;
const loginEnabled = process.env.LOGIN;
// Wenn LOGIN explizit auf "false" gesetzt ist, ist Login deaktiviert
// Ansonsten ist Login aktiviert (Standard-Verhalten)
return loginEnabled !== "false";
@@ -52,4 +52,3 @@ export function createSessionCookie(session: Session): string {
export function clearSessionCookie(): string {
return `${SESSION_COOKIE}=; HttpOnly; Path=/; Max-Age=0; SameSite=Lax`;
}