mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 13:56:57 +00:00
lint
This commit is contained in:
parent
8ba71e4d59
commit
d7a8875a0d
4 changed files with 7 additions and 7 deletions
|
@ -180,7 +180,7 @@ var (
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "no-dns-01",
|
Name: "no-dns-01",
|
||||||
Usage: "Always use individual certificats instead of a DNS-01 wild card certificate",
|
Usage: "Always use individual certificates instead of a DNS-01 wild card certificate",
|
||||||
EnvVars: []string{"NO_DNS_01"},
|
EnvVars: []string{"NO_DNS_01"},
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
|
|
|
@ -76,7 +76,7 @@ func TLSConfig(mainDomainSuffix string,
|
||||||
owner_exist, err := giteaClient.GiteaCheckIfOwnerExists(targetOwner)
|
owner_exist, err := giteaClient.GiteaCheckIfOwnerExists(targetOwner)
|
||||||
mayObtainCert = owner_exist
|
mayObtainCert = owner_exist
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msgf("Failed to check '%s' existance on the forge: %s", targetOwner, err)
|
log.Error().Err(err).Msgf("Failed to check '%s' existence on the forge: %s", targetOwner, err)
|
||||||
mayObtainCert = false
|
mayObtainCert = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ const (
|
||||||
// TODO: move as option into cache interface
|
// TODO: move as option into cache interface
|
||||||
fileCacheTimeout = 5 * time.Minute
|
fileCacheTimeout = 5 * time.Minute
|
||||||
|
|
||||||
// ownerExistanceCacheTimeout specifies the timeout for the existance of a repo/org
|
// ownerExistanceCacheTimeout specifies the timeout for the existence of a repo/org
|
||||||
ownerExistanceCacheTimeout = 5 * time.Minute
|
ownerExistenceCacheTimeout = 5 * time.Minute
|
||||||
|
|
||||||
// fileCacheSizeLimit limits the maximum file size that will be cached, and is set to 1 MB by default.
|
// fileCacheSizeLimit limits the maximum file size that will be cached, and is set to 1 MB by default.
|
||||||
fileCacheSizeLimit = int64(1000 * 1000)
|
fileCacheSizeLimit = int64(1000 * 1000)
|
||||||
|
|
|
@ -273,7 +273,7 @@ func (client *Client) GiteaCheckIfOwnerExists(owner string) (bool, error) {
|
||||||
|
|
||||||
_, resp, err := client.sdkClient.GetUserInfo(owner)
|
_, resp, err := client.sdkClient.GetUserInfo(owner)
|
||||||
if resp.StatusCode == http.StatusOK && err == nil {
|
if resp.StatusCode == http.StatusOK && err == nil {
|
||||||
if err := client.responseCache.Set(cacheKey, true, ownerExistanceCacheTimeout); err != nil {
|
if err := client.responseCache.Set(cacheKey, true, ownerExistenceCacheTimeout); err != nil {
|
||||||
log.Error().Err(err).Msg("[cache] error on cache write")
|
log.Error().Err(err).Msg("[cache] error on cache write")
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
|
@ -283,14 +283,14 @@ func (client *Client) GiteaCheckIfOwnerExists(owner string) (bool, error) {
|
||||||
|
|
||||||
_, resp, err = client.sdkClient.GetOrg(owner)
|
_, resp, err = client.sdkClient.GetOrg(owner)
|
||||||
if resp.StatusCode == http.StatusOK && err == nil {
|
if resp.StatusCode == http.StatusOK && err == nil {
|
||||||
if err := client.responseCache.Set(cacheKey, true, ownerExistanceCacheTimeout); err != nil {
|
if err := client.responseCache.Set(cacheKey, true, ownerExistenceCacheTimeout); err != nil {
|
||||||
log.Error().Err(err).Msg("[cache] error on cache write")
|
log.Error().Err(err).Msg("[cache] error on cache write")
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
} else if resp.StatusCode != http.StatusNotFound {
|
} else if resp.StatusCode != http.StatusNotFound {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if err := client.responseCache.Set(cacheKey, false, ownerExistanceCacheTimeout); err != nil {
|
if err := client.responseCache.Set(cacheKey, false, ownerExistenceCacheTimeout); err != nil {
|
||||||
log.Error().Err(err).Msg("[cache] error on cache write")
|
log.Error().Err(err).Msg("[cache] error on cache write")
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue