diff --git a/contribute/midaas-ws/main.py b/contribute/midaas-ws/main.py index 3e3734a..3e9c605 100644 --- a/contribute/midaas-ws/main.py +++ b/contribute/midaas-ws/main.py @@ -94,7 +94,7 @@ def create(response: Response, request: Request, domaine: str, type: str, valeur valeur += "." key = f"{domaine}./{type}/{valeur}" updated_data = data | {key: {"type": type, - "valeur": valeur, + "value": valeur, "ttl": TTL.ttl}} json.dump(updated_data, f) logger.info(f"Zone content : {updated_data}") diff --git a/main.go b/main.go index 2af6896..c3ac801 100644 --- a/main.go +++ b/main.go @@ -20,8 +20,8 @@ type Config struct { Host string `envconfig:"API_SERVER_HOST" default:"0.0.0.0"` } Options struct { - ReadTimeout time.Duration `envconfig:"API_READ_TIMEOUT" default:"3s"` - WriteTimeout time.Duration `envconfig:"API_WRITE_TIMEOUT" default:"3s"` + ReadTimeout time.Duration `envconfig:"API_READ_TIMEOUT" default:"10s"` + WriteTimeout time.Duration `envconfig:"API_WRITE_TIMEOUT" default:"10s"` LogLevel string `envconfig:"API_LOG_LEVEL" default:"INFO"` } Provider struct { diff --git a/midaas/midaas.go b/midaas/midaas.go index 479df2a..561e8f1 100644 --- a/midaas/midaas.go +++ b/midaas/midaas.go @@ -294,11 +294,17 @@ func (p *midaasProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, err return nil, err } + // Remove final dot in CNAME records + typeValue := fmt.Sprint(v["type"]) + targetValue := fmt.Sprint(v["value"]) + if typeValue == "CNAME" { + targetValue = strings.TrimSuffix(targetValue, ".") + } // Create Endpoint object e := endpoint.Endpoint{DNSName: strings.Split(index, "./")[0], - Targets: endpoint.Targets([]string{formatResponse(fmt.Sprint(v["value"]), 0)}), + Targets: endpoint.Targets([]string{formatResponse(targetValue, 0)}), RecordTTL: endpoint.TTL(intTTL), - RecordType: fmt.Sprint(v["type"])} + RecordType: typeValue} log.WithFields(log.Fields{"DNSName": e.DNSName, "Targets": e.Targets,