Fix generation of records for the origin
This commit is contained in:
parent
40e0dfeb9f
commit
fa647c7a4b
2 changed files with 10 additions and 6 deletions
12
api/zones.go
12
api/zones.go
|
@ -471,18 +471,18 @@ func getServiceRecords(opts *config.Options, req *RequestResources, body io.Read
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
svc := req.Zone.FindSubdomainService(req.Ps.ByName("subdomain"), serviceid)
|
subdomain := req.Ps.ByName("subdomain")
|
||||||
|
if subdomain == "" {
|
||||||
|
subdomain = "@"
|
||||||
|
}
|
||||||
|
|
||||||
|
svc := req.Zone.FindSubdomainService(subdomain, serviceid)
|
||||||
if svc == nil {
|
if svc == nil {
|
||||||
return APIErrorResponse{
|
return APIErrorResponse{
|
||||||
err: errors.New("Service not found"),
|
err: errors.New("Service not found"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subdomain := req.Ps.ByName("subdomain")
|
|
||||||
if subdomain == "" {
|
|
||||||
subdomain = "@"
|
|
||||||
}
|
|
||||||
|
|
||||||
var ret []serviceRecord
|
var ret []serviceRecord
|
||||||
for _, rr := range svc.GenRRs(subdomain, 3600, req.Domain.DomainName) {
|
for _, rr := range svc.GenRRs(subdomain, 3600, req.Domain.DomainName) {
|
||||||
ret = append(ret, serviceRecord{
|
ret = append(ret, serviceRecord{
|
||||||
|
|
|
@ -113,6 +113,10 @@ func (z *Zone) FindService(id []byte) (string, *ServiceCombined) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (z *Zone) findSubdomainService(subdomain string, id []byte) (int, *ServiceCombined) {
|
func (z *Zone) findSubdomainService(subdomain string, id []byte) (int, *ServiceCombined) {
|
||||||
|
if subdomain == "@" {
|
||||||
|
subdomain = ""
|
||||||
|
}
|
||||||
|
|
||||||
if services, ok := z.Services[subdomain]; ok {
|
if services, ok := z.Services[subdomain]; ok {
|
||||||
for k, svc := range services {
|
for k, svc := range services {
|
||||||
if bytes.Equal(svc.Id, id) {
|
if bytes.Equal(svc.Id, id) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue