Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui/dataLoaders): Use env var for telegraf config auth token #11693

Merged
merged 1 commit into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice


## 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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we won't store the exact token here anymore? Does that mean the auth token will need to be fetched separately for the TelegrafInstructionsOverlay in the other PR I've got open where it was using plugin.config.token?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes i do believe that will affect the Instructions Overlay in that way. Since we are not going to store that anymore, fetching it will be the only to get that value.

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