MCPcopy Create free account
hub / github.com/anchordotdev/cli / diagnosticServer

Method diagnosticServer

lcl/bootstrap.go:215–247  ·  view source on GitHub ↗
(ctx context.Context, cfg *cli.Config, drv *ui.Driver, realmAPID string, srv *api.Service)

Source from the content-addressed store, hash-verified

213}
214
215func (c Bootstrap) diagnosticServer(ctx context.Context, cfg *cli.Config, drv *ui.Driver, realmAPID string, srv *api.Service) (*diagnostic.Server, error) {
216 chainAPID := "ca" // FIXME: we need to lookup and pass the chain and/or make it non-optional
217 domains := []string{srv.Slug + ".lcl.host", srv.Slug + ".localhost"}
218
219 atch, err := c.anc.AttachService(ctx, chainAPID, domains, srv.Relationships.Organization.Slug, realmAPID, srv.Slug)
220 if err != nil {
221 return nil, err
222 }
223
224 mkcert := &MkCert{
225 anc: c.anc,
226 Domains: domains,
227 OrgAPID: srv.Relationships.Organization.Slug,
228 RealmAPID: realmAPID,
229 ServiceAPID: srv.Slug,
230
231 ChainAPID: atch.Relationships.Chain.Slug,
232 SubCaAPID: atch.Relationships.SubCa.Slug,
233 }
234
235 tlsCert, err := mkcert.perform(ctx, cfg, drv)
236 if err != nil {
237 return nil, err
238 }
239
240 return &diagnostic.Server{
241 Addr: cfg.Lcl.Diagnostic.Addr,
242 LclHostURL: cfg.Lcl.LclHostURL,
243 GetCertificate: func(cii *tls.ClientHelloInfo) (*tls.Certificate, error) {
244 return tlsCert, nil
245 },
246 }, nil
247}
248
249func (c Bootstrap) performAudit(ctx context.Context, drv *ui.Driver, orgAPID, realmAPID string) (*truststore.AuditInfo, error) {
250 stores, err := trust.LoadStores(ctx, drv)

Callers 1

performMethod · 0.95

Calls 2

performMethod · 0.95
AttachServiceMethod · 0.80

Tested by

no test coverage detected