An open API service indexing awesome lists of open source software.

https://github.com/libdns/vercel


https://github.com/libdns/vercel

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# Vercel DNS for `libdns`

This package implements the libdns interfaces for the [Vercel DNS API](https://vercel.com/docs/api#endpoints/dns)

## Authenticating

To authenticate you need to supply a Vercel [APIToken](https://vercel.com/docs/api#api-basics/authentication).
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 ⚠️⚠️__

```go
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)
}

```