mirror of https://github.com/go-gitea/gitea.git
Move httpsig algos slice to an init() function
This commit is contained in:
parent
76f06cee31
commit
d1f14ff2c7
|
@ -54,6 +54,15 @@ type Client struct {
|
|||
pubID string
|
||||
}
|
||||
|
||||
var algos []httpsig.Algorithm
|
||||
|
||||
func init() {
|
||||
algos = make([]httpsig.Algorithm, len(setting.Federation.Algorithms))
|
||||
for i, algo := range setting.Federation.Algorithms {
|
||||
algos[i] = httpsig.Algorithm(algo)
|
||||
}
|
||||
}
|
||||
|
||||
// NewClient function
|
||||
func NewClient(user *user_model.User, pubID string) (c *Client, err error) {
|
||||
if err = containsRequiredHTTPHeaders(http.MethodGet, setting.Federation.GetHeaders); err != nil {
|
||||
|
@ -61,10 +70,6 @@ func NewClient(user *user_model.User, pubID string) (c *Client, err error) {
|
|||
} else if err = containsRequiredHTTPHeaders(http.MethodPost, setting.Federation.PostHeaders); err != nil {
|
||||
return
|
||||
}
|
||||
algos := make([]httpsig.Algorithm, len(setting.Federation.Algorithms))
|
||||
for i, algo := range setting.Federation.Algorithms {
|
||||
algos[i] = httpsig.Algorithm(algo)
|
||||
}
|
||||
|
||||
priv, err := GetPrivateKey(user)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue