Files
archie/internal/app/controlplane/instructions.go
T

26 lines
800 B
Go

package controlplane
import (
"context"
"github.com/samcharles93/archie-core/internal/domain/agent"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
)
// InstructionsFor returns the system org's instructions and orgID's own.
// A system-org caller has no separate organisation layer.
func (s *Server) InstructionsFor(ctx context.Context, orgID string) (instance, organisation string, err error) {
var system agent.Soul
if err := s.readResource(ctx, storecontract.DefaultOrgID, SoulKind, &system); err != nil {
return "", "", err
}
if orgID == "" || orgID == storecontract.DefaultOrgID {
return system.Text, "", nil
}
var own agent.Soul
if err := s.readResource(ctx, orgID, SoulKind, &own); err != nil {
return "", "", err
}
return system.Text, own.Text, nil
}