- Frontend: Next.js 15 (App Router), Auth.js v5, shadcn/ui, MagicUI - Backend: Go + Gin + GORM with layered architecture - Auth: Local credentials login with optional Keycloak OAuth binding - Admin: RBAC user management for admin role - Dev: Docker Compose with hot reload for both frontend and backend - Docker: 3-service orchestration (frontend, backend, postgres) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
871 B
Go
39 lines
871 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
type Config struct {
|
|
DatabaseURL string
|
|
ServerPort string
|
|
ServerAPIURL string
|
|
AuthSecret string
|
|
KeycloakIssuer string
|
|
KeycloakID string
|
|
KeycloakSecret string
|
|
}
|
|
|
|
func Load() *Config {
|
|
_ = godotenv.Load()
|
|
|
|
return &Config{
|
|
DatabaseURL: getEnv("DATABASE_URL", "postgres://evan:evanpass@localhost:5432/evanpage?sslmode=disable"),
|
|
ServerPort: getEnv("SERVER_PORT", "8080"),
|
|
ServerAPIURL: getEnv("SERVER_API_URL", "http://localhost:8080"),
|
|
AuthSecret: getEnv("AUTH_SECRET", ""),
|
|
KeycloakIssuer: getEnv("AUTH_KEYCLOAK_ISSUER", ""),
|
|
KeycloakID: getEnv("AUTH_KEYCLOAK_ID", ""),
|
|
KeycloakSecret: getEnv("AUTH_KEYCLOAK_SECRET", ""),
|
|
}
|
|
}
|
|
|
|
func getEnv(key, fallback string) string {
|
|
if v := os.Getenv(key); v != "" {
|
|
return v
|
|
}
|
|
return fallback
|
|
}
|