influxdata / influxdb1-client

The old clientv2 for InfluxDB 1.x
MIT License
191 stars 112 forks source link

Influx Cloud support? #63

Closed cesarvspr closed 2 years ago

cesarvspr commented 2 years ago

How to use this lib with a Influx Db Cloud like https://europe-west1-1.gcp.cloud2.influxdata.com/

the cloud dashboard gives me a token, but the go client asks for the user and password.

cesarvspr commented 2 years ago

I found the solution on dashboard SDK

package main

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

   "github.com/influxdata/influxdb-client-go/v2"
)

func main() {
  // Create a client
  // You can generate an API Token from the "API Tokens Tab" in the UI
  client := influxdb2.NewClient("https://europe-west1-1.gcp.cloud2.influxdata.com", os.Getenv("INFLUX_TOKEN"))
  // always close client at the end
  defer client.Close()
}