This commit is contained in:
6543 2023-02-10 23:03:34 +01:00
parent cabd24af28
commit 01db2d50ae
2 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ func Serve(ctx *cli.Context) error {
} }
log.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger().Level(logLevel) log.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger().Level(logLevel)
giteaRoot := strings.TrimSuffix(ctx.String("gitea-root"), "/") giteaRoot := ctx.String("gitea-root")
giteaAPIToken := ctx.String("gitea-api-token") giteaAPIToken := ctx.String("gitea-api-token")
rawDomain := ctx.String("raw-domain") rawDomain := ctx.String("raw-domain")
mainDomainSuffix := ctx.String("pages-domain") mainDomainSuffix := ctx.String("pages-domain")
@ -68,7 +68,7 @@ func Serve(ctx *cli.Context) error {
allowedCorsDomains = append(allowedCorsDomains, rawDomain) allowedCorsDomains = append(allowedCorsDomains, rawDomain)
} }
// Make sure MainDomain has a trailing dot, and GiteaRoot has no trailing slash // Make sure MainDomain has a trailing dot
if !strings.HasPrefix(mainDomainSuffix, ".") { if !strings.HasPrefix(mainDomainSuffix, ".") {
mainDomainSuffix = "." + mainDomainSuffix mainDomainSuffix = "." + mainDomainSuffix
} }

View File

@ -1,6 +1,7 @@
package upstream package upstream
import ( import (
"errors"
"strings" "strings"
"time" "time"
@ -30,7 +31,7 @@ func (o *Options) CheckCanonicalDomain(giteaClient *gitea.Client, actualDomain,
} }
body, err := giteaClient.GiteaRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, canonicalDomainConfig) body, err := giteaClient.GiteaRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, canonicalDomainConfig)
if err == nil || err == gitea.ErrorNotFound { if err != nil && !errors.Is(err, gitea.ErrorNotFound) {
log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo) log.Info().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
} }