30 lines
657 B
Go
30 lines
657 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// Config holds startup configuration for the core module.
|
|
// RegistryDSN points at the control-plane registry DB (tenant list,
|
|
// connection info, superadmin accounts) — see nexarch-state.json
|
|
// multi_tenancy: Modell C (physisch getrennte DB pro Mandant).
|
|
type Config struct {
|
|
ListenAddr string
|
|
RegistryDSN string
|
|
}
|
|
|
|
func Load() (Config, error) {
|
|
dsn := os.Getenv("NEXARCH_REGISTRY_DSN")
|
|
if dsn == "" {
|
|
return Config{}, fmt.Errorf("NEXARCH_REGISTRY_DSN not set")
|
|
}
|
|
|
|
addr := os.Getenv("NEXARCH_LISTEN_ADDR")
|
|
if addr == "" {
|
|
addr = ":8080"
|
|
}
|
|
|
|
return Config{ListenAddr: addr, RegistryDSN: dsn}, nil
|
|
}
|