Use secrets
This page documents an earlier version of InfluxDB. InfluxDB v2.7 is the latest stable version. View this page in the v2.7 documentation.
Use secrets in a query
Import the influxdata/influxd/secrets package and use the secrets.get() function to populate sensitive data in queries with secrets from your secret store.
1. import "influxdata/influxdb/secrets"
2. import "sql"
4. username = secrets.get(key: "POSTGRES_USERNAME")
5. password = secrets.get(key: "POSTGRES_PASSWORD")
7. sql.from(
8. driverName: "postgres",
9. dataSourceName: "postgresql://${username}:${password}@localhost",
10. query:"SELECT * FROM example-table",
11. )
