From 26e2a15f3ade2667cbb05413608b0e0530e26c21 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Tue, 5 Feb 2019 14:11:32 -0800 Subject: [PATCH] feat(ui/dataLoaders): Use env var for telegraf config auth token instead of auth token --- CHANGELOG.md | 1 + ui/src/dataLoaders/actions/dataLoaders.ts | 4 ++-- .../components/verifyStep/CreateOrUpdateConfig.tsx | 4 +--- ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx | 2 +- ui/src/dataLoaders/reducers/dataLoaders.test.ts | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc51a33817..78485fccf9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v2.0.0-alpha.2 [unreleased] ## Features +1. [11693](https://github.com/influxdata/influxdb/pull/11693): Save the $INFLUX_TOKEN environmental variable in telegraf configs ## Bug Fixes 1. [11678](https://github.com/influxdata/influxdb/pull/11678): Update the System Telegraf Plugin bundle to include the swap plugin diff --git a/ui/src/dataLoaders/actions/dataLoaders.ts b/ui/src/dataLoaders/actions/dataLoaders.ts index a8689b53f14..21a5efc9fac 100644 --- a/ui/src/dataLoaders/actions/dataLoaders.ts +++ b/ui/src/dataLoaders/actions/dataLoaders.ts @@ -283,7 +283,7 @@ export const removePluginBundleWithPlugins = ( dispatch(removeBundlePlugins(bundle)) } -export const createOrUpdateTelegrafConfigAsync = (authToken: string) => async ( +export const createOrUpdateTelegrafConfigAsync = () => async ( dispatch, getState: GetState ) => { @@ -299,7 +299,7 @@ export const createOrUpdateTelegrafConfigAsync = (authToken: string) => async ( type: TelegrafPluginOutputInfluxDBV2.TypeEnum.Output, config: { urls: ['http://127.0.0.1:9999'], - token: authToken, + token: '$INFLUX_TOKEN', organization: org, bucket, }, diff --git a/ui/src/dataLoaders/components/verifyStep/CreateOrUpdateConfig.tsx b/ui/src/dataLoaders/components/verifyStep/CreateOrUpdateConfig.tsx index fe0fdeb0e57..0065f7abbb8 100644 --- a/ui/src/dataLoaders/components/verifyStep/CreateOrUpdateConfig.tsx +++ b/ui/src/dataLoaders/components/verifyStep/CreateOrUpdateConfig.tsx @@ -23,7 +23,6 @@ import {RemoteDataState, NotificationAction} from 'src/types' export interface OwnProps { org: string - authToken: string children: () => JSX.Element } @@ -50,7 +49,6 @@ export class CreateOrUpdateConfig extends PureComponent { public async componentDidMount() { const { onSaveTelegrafConfig, - authToken, notify, createDashboardsForPlugins, } = this.props @@ -58,7 +56,7 @@ export class CreateOrUpdateConfig extends PureComponent { this.setState({loading: RemoteDataState.Loading}) try { - await onSaveTelegrafConfig(authToken) + await onSaveTelegrafConfig() notify(TelegrafConfigCreationSuccess) await createDashboardsForPlugins() diff --git a/ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx b/ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx index 2056e41f50b..c6c2217542d 100644 --- a/ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx +++ b/ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx @@ -28,7 +28,7 @@ class DataStreaming extends PureComponent { return ( <> - + {() => ( { }, }, }) - await createOrUpdateTelegrafConfigAsync(token)(dispatch, getState) + await createOrUpdateTelegrafConfigAsync()(dispatch, getState) expect(dispatch).toBeCalledWith(setTelegrafConfigID(telegrafConfig.id)) })