https://github.com/libdns/vercel
https://github.com/libdns/vercel
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/libdns/vercel
- Owner: libdns
- License: mit
- Created: 2021-08-07T20:20:33.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-03T11:28:55.000Z (over 3 years ago)
- Last Synced: 2024-06-21T16:59:42.359Z (almost 2 years ago)
- Language: Go
- Size: 5.86 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
}
```