software steht so weit.

jetzt build + docker build und testen
This commit is contained in:
br committed 2026-10-02 13:25:34 +02:00
1 parent 42f0c0accb
commit ca6cdcca63
90 files changed
+10298 -480

No files matched your search

+34 -11
View File
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"time"
"sultan/pkg/license"
"sultan/pkg/policy"
@@ -14,8 +15,8 @@ import (
// directory liefert der Registry Mandant, Lizenz und Drain-Status eines
// Knotens aus dem Store.
//
// Solange Migration v2 fehlt (Spec Abschnitt 9), wird die Lizenz aus dem
// Mandanten-Datensatz abgeleitet: ohne Features und ohne Mahnstufe.
// Die Lizenz wird aus dem Mandanten-Datensatz abgeleitet (inkl. Features);
// die Mahnstufe ergibt sich aus der offenen Zahlung (DunningSchedule).
type directory struct {
store *store.Store
}
@@ -36,15 +37,37 @@ func (d *directory) NodeContext(ctx context.Context, nodeID string) (registry.No
return registry.NodeContext{}, err
}
return registry.NodeContext{
Tenant: policy.Tenant{ID: t.ID, Status: t.Status},
License: license.License{
TenantID: t.ID,
Tier: license.Tier(t.Tier),
MaxRoutes: t.MaxRoutes,
AllowedDomains: t.AllowedDomains,
Features: []license.Feature{},
ValidUntil: t.ValidUntil,
Tenant: policy.Tenant{
ID: t.ID,
Status: t.Status,
DunningLevel: policy.DunningSchedule{}.Level(t.PaymentOverdueSince, time.Now()),
},
Drained: node.Status == store.NodeDrained,
License: licenseOf(t),
Drained: node.Status == store.NodeDrained,
Maintenance: maintenanceOf(node),
Disconnected: node.Status == store.NodeOffline,
}, nil
}
// licenseOf leitet die (unsignierte) Lizenz aus dem Mandanten-Datensatz ab.
func licenseOf(t store.Tenant) license.License {
features := make([]license.Feature, 0, len(t.Features))
for _, f := range t.Features {
features = append(features, license.Feature(f))
}
return license.License{
TenantID: t.ID,
Tier: license.Tier(t.Tier),
MaxRoutes: t.MaxRoutes,
AllowedDomains: t.AllowedDomains,
Features: features,
ValidUntil: t.ValidUntil,
}
}
func maintenanceOf(n store.Node) *policy.Maintenance {
if n.Maintenance == nil {
return nil
}
return &policy.Maintenance{Until: n.Maintenance.Until, PublicReason: n.Maintenance.PublicReason}
}