core: initial Go module skeleton (config, db pool, tenant registry migration)

This commit is contained in:
sysops
2026-08-27 17:27:59 +02:00
parent 72261cc69f
commit c895a67c4b
7 changed files with 136 additions and 0 deletions
+29
View File
@@ -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
}
+11
View File
@@ -0,0 +1,11 @@
package db
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
)
func Connect(ctx context.Context, dsn string) (*pgxpool.Pool, error) {
return pgxpool.New(ctx, dsn)
}