Files
tenant-registry/internal/config/config.go
T
sharang 93cfbd6e2b
ci / shared (pull_request) Successful in 5s
ci / test (pull_request) Successful in 10s
ci / image (pull_request) Has been skipped
fix(dev): tenant-registry default port :8080 → :8090
Keycloak owns :8080 in the dev stack (docker-compose binds host:8080).
Running tenant-registry on the same port made 'make dev' refuse to
boot. Bump the default to :8090 across config, Makefile, Dockerfile,
.env.example, and README. ADDR env var still overrides if needed.

Production is unaffected — each service is in its own Orca container
with its own port-namespace.

Refs: M5.1 (unblocks portal local dev)
2026-05-19 11:44:19 +02:00

35 lines
874 B
Go

package config
import (
"fmt"
"os"
)
type Config struct {
Env string // dev | stage | prod
Addr string // listen address, e.g. ":8090"
KeycloakIssuer string // e.g. http://localhost:8080/realms/breakpilot-dev
DatabaseURL string // postgres DSN (unused in skeleton; in-memory store)
}
func Load() (*Config, error) {
env := getenv("APP_ENV", "dev")
if env != "dev" && env != "stage" && env != "prod" {
return nil, fmt.Errorf("invalid APP_ENV %q", env)
}
return &Config{
Env: env,
// :8090 — Keycloak owns :8080 in the dev stack.
Addr: getenv("ADDR", ":8090"),
KeycloakIssuer: getenv("KEYCLOAK_ISSUER", "http://localhost:8080/realms/breakpilot-dev"),
DatabaseURL: os.Getenv("DATABASE_URL"),
}, nil
}
func getenv(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}