Files
AetherForge/server/internal/cloudmap/registry.go
AetherForge 5b5fc7c01c
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Add Emberwake Cloud Ecosystem deploy hub with AWS and generic spread templates.
Unified expandable panels with mermaid flows, ZIP export, connection tests, and Playwright smoke coverage.
2026-06-07 10:03:22 -07:00

41 lines
1.1 KiB
Go

package cloudmap
import "strings"
type RegistryDocument struct {
Namespace string `json:"namespace"`
Service string `json:"service"`
UpdatedAt string `json:"updated_at"`
Instances []RegistryInstance `json:"instances"`
}
type RegistryInstance struct {
AgentID string `json:"agent_id"`
DNSName string `json:"dns_name"`
IP string `json:"ip"`
FetchURL string `json:"fetch_url"`
Port int `json:"port"`
Healthy bool `json:"healthy"`
}
func SeederDNSName(service, namespace string) string {
if strings.TrimSpace(service) == "" {
service = "seeder"
}
if strings.TrimSpace(namespace) == "" {
namespace = "prod.local"
}
return strings.TrimSpace(service) + ".svc." + strings.TrimSpace(namespace)
}
func NormalizeRegistryDocument(doc RegistryDocument) (RegistryDocument, bool) {
doc.Namespace = strings.TrimSpace(doc.Namespace)
doc.Service = strings.TrimSpace(doc.Service)
if doc.Namespace == "" {
doc.Namespace = "prod.local"
}
if doc.Service == "" {
doc.Service = "seeder"
}
return doc, doc.Namespace != "" && doc.Service != ""
}