mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-26 05:55:27 +00:00
make certdb maintain go routine a own func
This commit is contained in:
parent
de439f9bec
commit
a0e0d2d335
@ -109,6 +109,9 @@ func Serve(ctx *cli.Context) error {
|
||||
|
||||
certificates.SetupCertificates(mainDomainSuffix, dnsProvider, acmeConfig, acmeUseRateLimits, enableHTTPServer, challengeCache, keyDatabase)
|
||||
|
||||
// TODO: make it graceful
|
||||
go certificates.MaintainCertDB(mainDomainSuffix, dnsProvider, acmeUseRateLimits, keyDatabase)
|
||||
|
||||
if enableHTTPServer {
|
||||
go func() {
|
||||
err := httpServer.ListenAndServe("[::]:80")
|
||||
|
@ -444,18 +444,9 @@ func SetupCertificates(mainDomainSuffix []byte, dnsProvider string, acmeConfig *
|
||||
log.Printf("[ERROR] Couldn't renew main domain certificate, continuing with mock certs only: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
go (func() {
|
||||
for {
|
||||
err := keyDatabase.Sync()
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Syncing key database failed: %s", err)
|
||||
}
|
||||
time.Sleep(5 * time.Minute)
|
||||
// TODO: graceful exit
|
||||
}
|
||||
})()
|
||||
go (func() {
|
||||
func MaintainCertDB(mainDomainSuffix []byte, dnsProvider string, acmeUseRateLimits bool, keyDatabase database.CertDB) {
|
||||
for {
|
||||
// clean up expired certs
|
||||
now := time.Now()
|
||||
@ -514,5 +505,4 @@ func SetupCertificates(mainDomainSuffix []byte, dnsProvider string, acmeConfig *
|
||||
|
||||
time.Sleep(12 * time.Hour)
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user