added flux secrets package

pull/433/head
Scott Anderson 2019-09-05 08:43:11 -06:00
parent 3d8ac8ffe5
commit a15b45865b
2 changed files with 66 additions and 0 deletions

View File

@ -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" >}}

View File

@ -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"
)
```