feat: register app with Origin

This commit is contained in:
SG Command
2026-08-13 12:06:50 +02:00
parent d8f70cf731
commit 613db495e8
6 changed files with 81 additions and 3 deletions
+21
View File
@@ -1,6 +1,7 @@
package main
import (
"context"
"embed"
"fmt"
"io/fs"
@@ -10,6 +11,7 @@ import (
"path/filepath"
"strings"
originclient "git.warky.dev/wdevs/origin_client/go"
"wedding-server/internal/api"
"wedding-server/internal/config"
"wedding-server/internal/mail"
@@ -39,6 +41,25 @@ func main() {
mailer := mail.New(cfg.Email)
wh := webhook.New(cfg.Webhook)
if cfg.Origin.ServiceKey == "" {
log.Printf("origin registration disabled: origin.service_key is not configured")
} else {
origin, err := originclient.New(originclient.Config{
URL: cfg.Origin.URL,
ServiceKey: cfg.Origin.ServiceKey,
Type: "CronoCraft App",
Version: cfg.Origin.Version,
Name: "ZoeShaldon",
AppType: "go",
Port: cfg.Server.Port,
BaseURL: cfg.Site.URL,
Description: "CronoCraft App - ZoeShaldon wedding site",
})
if err != nil {
log.Fatalf("origin client: %v", err)
}
go origin.Run(context.Background())
}
mux := http.NewServeMux()
api.New(cfg, st, mailer, wh).Routes(mux)