From 8bd4e1d73e3886894f5a667cb41aea630c3ade0f Mon Sep 17 00:00:00 2001 From: Mariano Cano Date: Wed, 27 Apr 2022 12:13:16 -0700 Subject: [PATCH] Inject the acme database in the context --- ca/ca.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ca/ca.go b/ca/ca.go index f5cf30db..80756559 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -282,7 +282,7 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) { } // Create context with all the necessary values. - baseContext := buildContext(auth) + baseContext := buildContext(auth, acmeDB) ca.srv = server.New(cfg.Address, handler, tlsConfig) ca.srv.BaseContext = func(net.Listener) context.Context { @@ -306,7 +306,7 @@ func (ca *CA) Init(cfg *config.Config) (*CA, error) { } // buildContext builds the server base context. -func buildContext(a *authority.Authority) context.Context { +func buildContext(a *authority.Authority, acmeDB acme.DB) context.Context { ctx := authority.NewContext(context.Background(), a) if authDB := a.GetDatabase(); authDB != nil { ctx = db.NewContext(ctx, authDB) @@ -314,6 +314,9 @@ func buildContext(a *authority.Authority) context.Context { if adminDB := a.GetAdminDatabase(); adminDB != nil { ctx = admin.NewContext(ctx, adminDB) } + if acmeDB != nil { + ctx = acme.NewContext(ctx, acmeDB) + } return ctx }