in

Netcup provider implementation for libdns


This package implements the libdns interfaces for the netcup DNS API, allowing you to manage DNS records.

Configuration

The provider is configured by instantiating the netcup.Provider with the customer number, the API key and the API password for the DNS API obtained from netcup (guide).
Here is a minimal working example to get all DNS records using environment variables for the credentials:

import (
	"context"
	"fmt"
	"os"

	"github.com/libdns/netcup"
)

func main() {
	provider := netcup.Provider{
		CustomerNumber: os.Getenv("LIBDNS_NETCUP_CUSTOMER_NUMBER"),
		APIKey:         os.Getenv("LIBDNS_NETCUP_API_KEY"),
		APIPassword:    os.Getenv("LIBDNS_NETCUP_API_PASSWORD"),
	}
	ctx := context.TODO()
	zone := os.Getenv("LIBDNS_NETCUP_ZONE")

	records, err := provider.GetRecords(ctx, zone)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	for _, record := range records {
		fmt.Printf("%+vn", record)
	}
}

Usage

⚠️ The netcup API does not offer setting the TTL for individual records.

Updating and deleting records can be done by either filling all struct fields of the dnsRecord, including the ID, or just Name and Type (+ Priority for MX records). Then the first record matching these criteria is updated/deleted.

GitHub

View Github


How could I check If a zip file is corrupted in NodeJS?

Custom page name instead of the default "index.vue" in nuxt.js