add first default branch on DNS query

This commit is contained in:
Simon Vieille 2022-08-18 11:40:29 +02:00
parent 865cc9f1f6
commit 320564ec18
No known key found for this signature in database
GPG key ID: 579388D585F70417
4 changed files with 9 additions and 7 deletions

View file

@ -38,6 +38,7 @@ import (
// TLSConfig returns the configuration for generating, serving and cleaning up Let's Encrypt certificates.
func TLSConfig(mainDomainSuffix []byte,
giteaClient *gitea.Client,
firstDefaultBranch,
dnsProvider string,
acmeUseRateLimits bool,
keyCache, challengeCache, dnsLookupCache, canonicalDomainCache cache.SetGetKey,
@ -75,7 +76,7 @@ func TLSConfig(mainDomainSuffix []byte,
sni = string(sniBytes)
} else {
var targetRepo, targetBranch string
targetOwner, targetRepo, targetBranch = dnsutils.GetTargetFromDNS(sni, string(mainDomainSuffix), dnsLookupCache)
targetOwner, targetRepo, targetBranch = dnsutils.GetTargetFromDNS(sni, string(mainDomainSuffix), firstDefaultBranch, dnsLookupCache)
if targetOwner == "" {
// DNS not set up, return main certificate to redirect to the docs
sniBytes = mainDomainSuffix