forked from TrueCloudLab/certificates
Inject the acme database in the context
This commit is contained in:
parent
bd412c9f42
commit
8bd4e1d73e
1 changed files with 5 additions and 2 deletions
7
ca/ca.go
7
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue