Documentation

secrets.get() function

Flux 0.41.0+

The secrets.get() function retrieves a secret from the InfluxDB secret store.

import "influxdata/influxdb/secrets"

secrets.get(key: "KEY_NAME")

Parameters

key

The secret key to retrieve.

Examples

Populate sensitive credentials with secrets

import "sql"
import "influxdata/influxdb/secrets"

username = secrets.get(key: "POSTGRES_USERNAME")
password = secrets.get(key: "POSTGRES_PASSWORD")

sql.from(
  driverName: "postgres",
  dataSourceName: "postgresql://${username}:${password}@localhost",
  query:"SELECT * FROM example-table"
)

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.