added flux secrets package
parent
3d8ac8ffe5
commit
a15b45865b
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
title: Flux InfluxDB Secrets package
|
||||||
|
list_title: InfluxDB Secrets package
|
||||||
|
description: >
|
||||||
|
The Flux InfluxDB Secrets package provides functions for working with sensitive secrets managed by InfluxDB.
|
||||||
|
Import the `influxdata/influxdb/secrets` package.
|
||||||
|
menu:
|
||||||
|
v2_0_ref:
|
||||||
|
name: InfluxDB Secrets
|
||||||
|
parent: Flux packages and functions
|
||||||
|
weight: 202
|
||||||
|
v2.0/tags: [functions, secrets, package]
|
||||||
|
---
|
||||||
|
|
||||||
|
InfluxDB Secrets Flux functions provide tools for working with sensitive secrets managed by InfluxDB.
|
||||||
|
Import the `influxdata/influxdb/secrets` package:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import "influxdata/influxdb/secrets"
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< children type="functions" show="pages" >}}
|
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
title: secrets.get() function
|
||||||
|
description: >
|
||||||
|
The `secrets.get()` function retrieves a secret from the InfluxDB secret store.
|
||||||
|
menu:
|
||||||
|
v2_0_ref:
|
||||||
|
name: secrets.get
|
||||||
|
parent: InfluxDB Secrets
|
||||||
|
weight: 202
|
||||||
|
---
|
||||||
|
|
||||||
|
The `secrets.get()` function retrieves a secret from the InfluxDB secret store.
|
||||||
|
|
||||||
|
_**Function type:** Miscellaneous_
|
||||||
|
|
||||||
|
```js
|
||||||
|
import "influxdata/influxdb/secrets"
|
||||||
|
|
||||||
|
secrets.get(key: "KEY_NAME")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
### key
|
||||||
|
The secret key to retrieve.
|
||||||
|
|
||||||
|
_**Data type:** String_
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Populate sensitive credentials with secrets
|
||||||
|
```js
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
```
|
Loading…
Reference in New Issue