2014-07-25 18:21:15 +02:00
|
|
|
package cloudflare
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2016-04-27 19:04:07 +02:00
|
|
|
"github.com/crackcomm/cloudflare"
|
2014-07-25 18:21:15 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
2014-11-17 18:57:41 +01:00
|
|
|
Email string
|
|
|
|
Token string
|
2014-07-25 18:21:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Client() returns a new client for accessing cloudflare.
|
|
|
|
func (c *Config) Client() (*cloudflare.Client, error) {
|
2016-04-27 19:04:07 +02:00
|
|
|
client := cloudflare.New(&cloudflare.Options{
|
|
|
|
Email: c.Email,
|
|
|
|
Key: c.Token,
|
|
|
|
})
|
2014-07-25 18:21:15 +02:00
|
|
|
|
2016-04-27 19:04:07 +02:00
|
|
|
log.Printf("[INFO] CloudFlare Client configured for user: %s", c.Email)
|
2014-07-25 18:21:15 +02:00
|
|
|
|
|
|
|
return client, nil
|
|
|
|
}
|