Use secrets

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. )

secrets security