core: initial Go module skeleton (config, db pool, tenant registry migration)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user