mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
untouch unrelated
This commit is contained in:
parent
c5040b622d
commit
d7d853e3e6
1 changed files with 4 additions and 2 deletions
|
@ -11,6 +11,8 @@ import (
|
||||||
// lookupCacheTimeout specifies the timeout for the DNS lookup cache.
|
// lookupCacheTimeout specifies the timeout for the DNS lookup cache.
|
||||||
var lookupCacheTimeout = 15 * time.Minute
|
var lookupCacheTimeout = 15 * time.Minute
|
||||||
|
|
||||||
|
var defaultPagesRepo = "pages"
|
||||||
|
|
||||||
// GetTargetFromDNS searches for CNAME or TXT entries on the request domain ending with MainDomainSuffix.
|
// GetTargetFromDNS searches for CNAME or TXT entries on the request domain ending with MainDomainSuffix.
|
||||||
// If everything is fine, it returns the target data.
|
// If everything is fine, it returns the target data.
|
||||||
func GetTargetFromDNS(domain, mainDomainSuffix, firstDefaultBranch string, dnsLookupCache cache.SetGetKey) (targetOwner, targetRepo, targetBranch string) {
|
func GetTargetFromDNS(domain, mainDomainSuffix, firstDefaultBranch string, dnsLookupCache cache.SetGetKey) (targetOwner, targetRepo, targetBranch string) {
|
||||||
|
@ -50,9 +52,9 @@ func GetTargetFromDNS(domain, mainDomainSuffix, firstDefaultBranch string, dnsLo
|
||||||
targetBranch = cnameParts[len(cnameParts)-3]
|
targetBranch = cnameParts[len(cnameParts)-3]
|
||||||
}
|
}
|
||||||
if targetRepo == "" {
|
if targetRepo == "" {
|
||||||
targetRepo = firstDefaultBranch
|
targetRepo = defaultPagesRepo
|
||||||
}
|
}
|
||||||
if targetBranch == "" && targetRepo != firstDefaultBranch {
|
if targetBranch == "" && targetRepo != defaultPagesRepo {
|
||||||
targetBranch = firstDefaultBranch
|
targetBranch = firstDefaultBranch
|
||||||
}
|
}
|
||||||
// if targetBranch is still empty, the caller must find the default branch
|
// if targetBranch is still empty, the caller must find the default branch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue