Skip to content

Commit

Permalink
Merge pull request #11693 from influxdata/feat/telegraf-auth-envvar
Browse files Browse the repository at this point in the history
feat(ui/dataLoaders): Use env var for telegraf config auth token
  • Loading branch information
ischolten authored Feb 5, 2019
2 parents 8f96a72 + 26e2a15 commit 14482cf
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions ui/src/dataLoaders/actions/dataLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export const removePluginBundleWithPlugins = (
dispatch(removeBundlePlugins(bundle))
}

export const createOrUpdateTelegrafConfigAsync = (authToken: string) => async (
export const createOrUpdateTelegrafConfigAsync = () => async (
dispatch,
getState: GetState
) => {
Expand All @@ -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,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {RemoteDataState, NotificationAction} from 'src/types'

export interface OwnProps {
org: string
authToken: string
children: () => JSX.Element
}

Expand All @@ -50,15 +49,14 @@ export class CreateOrUpdateConfig extends PureComponent<Props, State> {
public async componentDidMount() {
const {
onSaveTelegrafConfig,
authToken,
notify,
createDashboardsForPlugins,
} = this.props

this.setState({loading: RemoteDataState.Loading})

try {
await onSaveTelegrafConfig(authToken)
await onSaveTelegrafConfig()
notify(TelegrafConfigCreationSuccess)
await createDashboardsForPlugins()

Expand Down
2 changes: 1 addition & 1 deletion ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DataStreaming extends PureComponent<Props> {

return (
<>
<CreateOrUpdateConfig org={org} authToken={authToken}>
<CreateOrUpdateConfig org={org}>
{() => (
<TelegrafInstructions
notify={notify}
Expand Down
3 changes: 1 addition & 2 deletions ui/src/dataLoaders/reducers/dataLoaders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
processesTelegrafPlugin,
systemTelegrafPlugin,
redisTelegrafPlugin,
token,
telegrafConfig,
dockerTelegrafPlugin,
swapTelegrafPlugin,
Expand Down Expand Up @@ -488,7 +487,7 @@ describe('dataLoader reducer', () => {
},
},
})
await createOrUpdateTelegrafConfigAsync(token)(dispatch, getState)
await createOrUpdateTelegrafConfigAsync()(dispatch, getState)

expect(dispatch).toBeCalledWith(setTelegrafConfigID(telegrafConfig.id))
})
Expand Down

0 comments on commit 14482cf

Please sign in to comment.