Files
archie/internal/app/servicekit/statestore.go
T
sam fa58050281 refactor(archiegateway): own package for the Gateway service
archie-gateway no longer links the daemon, the web UI or archied. Shared
runtime layering, watches, catalog, NATS discovery and the State Store client
live in servicekit; chat task profiles in chattask. The Gateway waits for the
daemon's NATS endpoint instead of starting a second broker, and chat
approvals go through the task-action client instead of a local service with
no daemon behind it. Version stamping uses buildinfo only.
2026-10-04 00:59:02 +10:00

21 lines
848 B
Go

package servicekit
import (
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/secret"
)
// StateStoreClient dials the State Store gRPC service the daemon's own
// capture/mapping/binding consumers call. Token resolution is the daemon's
// (it owns the config keys and the secret registry); the dial itself and the
// fail-closed non-loopback rule belong to the transport, so they come
// from staterpc.Dial.
func StateStoreClient(services config.Services, secrets *secret.Registry) (*staterpc.Client, func(), error) {
target, err := services.RequireTarget(config.ServiceNameState)
if err != nil {
return nil, nil, err
}
return staterpc.Dial(target, services.ResolvedToken(config.ServiceNameState, secrets.Getenv))
}