feat(api-keys): CI licences by API key and integration keys (#71)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m10s
ci / image (push) Successful in 36s

This commit was merged in pull request #71.
This commit is contained in:
sharang committed 2026-10-13 22:12:05 +00:00
1 parent 97284b5008
commit 5b4590d3bc
28 files changed
+1231 -42

No files matched your search

+11 -1
View File
@@ -19,6 +19,7 @@ import (
"git.breakpilot.com/platform/tenant-registry/internal/licence"
"git.breakpilot.com/platform/tenant-registry/internal/llmkeys"
"git.breakpilot.com/platform/tenant-registry/internal/product"
"git.breakpilot.com/platform/tenant-registry/internal/secretbox"
"git.breakpilot.com/platform/tenant-registry/internal/server"
"git.breakpilot.com/platform/tenant-registry/internal/store"
"git.breakpilot.com/platform/tenant-registry/migrations"
@@ -126,6 +127,15 @@ func main() {
slog.Info("licence signer configured", "kid", signer.KID(), "issuer", signer.Issuer())
}
secrets, err := secretbox.New(cfg.SecretsEncryptionKey)
if err != nil {
slog.Error("secrets encryption key invalid", "err", err)
os.Exit(1)
}
if !secrets.Enabled() {
slog.Warn("SECRETS_ENCRYPTION_KEY not set — a reused Werkpilot CI licence cannot hand out its LiteLLM key again")
}
// LiteLLM virtual keys for Werkpilot licences (D6).
llmKeys := llmkeys.New(llmkeys.Config{BaseURL: cfg.LiteLLMBaseURL, MasterKey: cfg.LiteLLMMasterKey, Models: cfg.LiteLLMModels,
BudgetTrial: cfg.LiteLLMBudgetTrial, BudgetDefault: cfg.LiteLLMBudgetDefault})
@@ -157,7 +167,7 @@ func main() {
if mc := (mail.Config{Host: cfg.SMTPHost, Port: cfg.SMTPPort, User: cfg.SMTPUser, Password: cfg.SMTPPassword, From: cfg.MailFrom, FromName: cfg.MailFromName}); mc.Configured() {
mailer = &mail.SMTP{Cfg: mc}
}
app := &server.Server{Cfg: cfg, Log: logger, Store: s, Keycloak: kc, Auth: av, Authz: authz, Product: pv, ERP: erpClient, Licences: signer, LLMKeys: llmKeys, Objects: objects, Mail: mailer}
app := &server.Server{Cfg: cfg, Log: logger, Store: s, Keycloak: kc, Auth: av, Authz: authz, Product: pv, ERP: erpClient, Licences: signer, LLMKeys: llmKeys, Secrets: secrets, Objects: objects, Mail: mailer}
handler := server.NewRouter(app)
srv := &http.Server{
Addr: cfg.Addr,