Move httpsig algs constant slice to modules/setting/federation.go

This commit is contained in:
Anthony Wang
2022-06-14 12:16:32 -05:00
parent e60158c70b
commit a4403e4e80
2 changed files with 9 additions and 10 deletions

View File

@ -29,6 +29,9 @@ var (
}
)
// Constant slice of httpsig algorithm objects
var HttpsigAlgs []httpsig.Algorithm
func newFederationService() {
if err := Cfg.Section("federation").MapTo(&Federation); err != nil {
log.Fatal("Failed to map Federation settings: %v", err)
@ -36,4 +39,9 @@ func newFederationService() {
log.Fatal("unsupported digest algorithm: %s", Federation.DigestAlgorithm)
return
}
HttpsigAlgs = make([]httpsig.Algorithm, len(Federation.Algorithms))
for i, alg := range Federation.Algorithms {
HttpsigAlgs[i] = httpsig.Algorithm(alg)
}
}