breakout
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/promotions"
|
||||
promotionmcp "git.k6n.net/mats/go-cart-actor/pkg/promotions/mcp"
|
||||
"git.k6n.net/mats/go-cart-actor/internal/ucp"
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/profile"
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/proxy"
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/voucher"
|
||||
"git.k6n.net/mats/go-redis-inventory/pkg/inventory"
|
||||
@@ -297,38 +296,6 @@ func main() {
|
||||
|
||||
syncedServer.Serve(mux)
|
||||
|
||||
// ── Profile / Customer UCP endpoint ───────────────────────────────────
|
||||
profileReg := profile.NewProfileMutationRegistry()
|
||||
profileDir := getEnv("PROFILE_DIR", "data/profiles")
|
||||
_ = os.MkdirAll(profileDir, 0755)
|
||||
profileStorage := actor.NewDiskStorage[profile.ProfileGrain](profileDir, profileReg)
|
||||
|
||||
profilePoolConfig := actor.GrainPoolConfig[profile.ProfileGrain]{
|
||||
MutationRegistry: profileReg,
|
||||
Storage: profileStorage,
|
||||
Spawn: func(ctx context.Context, id uint64) (actor.Grain[profile.ProfileGrain], error) {
|
||||
ret := profile.NewProfileGrain(id, time.Now())
|
||||
err := profileStorage.LoadEvents(ctx, id, ret)
|
||||
return ret, err
|
||||
},
|
||||
TTL: 10 * time.Minute,
|
||||
PoolSize: 65535,
|
||||
Hostname: podIp,
|
||||
}
|
||||
|
||||
profilePool, poolErr := actor.NewSimpleGrainPool(profilePoolConfig)
|
||||
if poolErr != nil {
|
||||
log.Fatalf("Error creating profile pool: %v\n", poolErr)
|
||||
}
|
||||
|
||||
// UCP Customer REST adapter
|
||||
customerUCP := ucp.CustomerHandler(profilePool)
|
||||
if signer := loadUCPCartSigner(); signer != nil {
|
||||
customerUCP = ucp.WithSigning(customerUCP, signer)
|
||||
log.Print("ucp customer signing enabled")
|
||||
}
|
||||
mux.Handle("/ucp/v1/customers/", http.StripPrefix("/ucp/v1/customers", customerUCP))
|
||||
|
||||
// Promotion MCP edge: list/get/upsert/status/delete promotions and preview
|
||||
// discounts. Mutations persist to data/promotions.json and are picked up by
|
||||
// the cart's totals processor on the next mutation (it reads a fresh snapshot).
|
||||
|
||||
Reference in New Issue
Block a user