Skip to content

libdns/vercel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vercel DNS for libdns

This package implements the libdns interfaces for the Vercel DNS API

Authenticating

To authenticate you need to supply a Vercel APIToken. For Testing purposes you can get a Testing Token from your Vercel dashboard.

Please keep in mind that Vercel has a hard Rate-Limit of 100 API Calls per Hour.

⚠️⚠️ You currently can't retrieve TTL values for your records with the Vercel API ⚠️⚠️

package main

import (
	"context"
	"fmt"
	"os"
	"time"

	"github.com/libdns/vercel"
)

func main() {
	token := os.Getenv("LIBDNS_VERCEL_TOKEN")
	if token == "" {
		fmt.Printf("LIBDNS_VERCEL_TOKEN not set\n")
		return
	}

	zone := os.Getenv("LIBDNS_VERCEL_ZONE")
	if token == "" {
		fmt.Printf("LIBDNS_VERCEL_ZONE not set\n")
		return
	}

	p := &vercel.Provider{
		AuthAPIToken: token,
	}

	records, err := p.GetRecords(context.WithTimeout(context.Background(), time.Duration(15*time.Second)), zone)
	if err != nil {
        fmt.Printf("Error: %s", err.Error())
        return
	}

	fmt.Println(records)
}