(ctx context.Context, cfg *cli.Config, drv *ui.Driver, realmAPID string, srv *api.Service)
| 213 | } |
| 214 | |
| 215 | func (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 | |
| 249 | func (c Bootstrap) performAudit(ctx context.Context, drv *ui.Driver, orgAPID, realmAPID string) (*truststore.AuditInfo, error) { |
| 250 | stores, err := trust.LoadStores(ctx, drv) |
no test coverage detected