Skip to content

Add telegraf url env var#8987

Merged
reimda merged 7 commits intoinfluxdata:masterfrom
Kuzyashin:add_telegraf_url_env-var
Jun 3, 2021
Merged

Add telegraf url env var#8987
reimda merged 7 commits intoinfluxdata:masterfrom
Kuzyashin:add_telegraf_url_env-var

Conversation

@Kuzyashin
Copy link
Copy Markdown
Contributor

@Kuzyashin Kuzyashin commented Mar 14, 2021

Closes #8909.
Add $TELEGRAF_CONFIG_URL to config discovery

Copy link
Copy Markdown
Contributor

@telegraf-tiger telegraf-tiger bot left a comment

Choose a reason for hiding this comment

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

🤝 ✅ CLA has been signed. Thank you!

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Mar 14, 2021
Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@srebhan srebhan self-assigned this Mar 15, 2021
@srebhan srebhan added area/configuration ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Mar 15, 2021
config/config.go Outdated
Comment on lines 695 to 696
urlfile := os.Getenv("TELEGRAF_CONFIG_URL")
envfile := os.Getenv("TELEGRAF_CONFIG_PATH")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The -config command line option takes either a local path or a URL. I think we should also have one environment variable that takes either a local path or a URL. I would prefer to keep TELEGRAF_CONFIG_PATH for backward compatibility and allow it to accept URLs.

It is unfortunate that the "_PATH" might make users think it only accepts local paths, but I think this is better than having two environment variables. We should make sure to add to the documentation to let users know URLs work too.

In the long term we may want to consider renaming the single env var to something more generic like "TELEGRAF_CONFIG" but that would be a breaking change so it would have to wait for a major release (2.0.0) where compatibility can be broken.

For this PR to be merged, could you remove the new TELEGRAF_CONFIG_URL env var? It looks like we may also need to combine the getDefaultConfigPath and LoadConfig and loadConfig functions because getDefaultConfigPath checks if the string is a file path, but loadConfig checks if it's a URL. I think we will need to do that in the same function.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Kuzyashin What do you think of this approach? Are you able to work on this PR more?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. I can push new commits in 2-3 days.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let me know if you can't find the time for this and we'll pass it on to someone else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@reimda can you please check again, I think your comment was resolved with the latest commits.

@srebhan srebhan removed the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Apr 6, 2021
@jessingrass jessingrass added the waiting for response waiting for response from contributor label Apr 20, 2021
@srebhan
Copy link
Copy Markdown
Member

srebhan commented Jun 1, 2021

@Kuzyashin did you have any chance to take a look?

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Hey @Kuzyashin! Thanks for your quick response. There are two minor comment in the code. Can you please take a look?

@srebhan srebhan removed the waiting for response waiting for response from contributor label Jun 1, 2021
@Kuzyashin
Copy link
Copy Markdown
Contributor Author

Hey @Kuzyashin! Thanks for your quick response. There are two minor comment in the code. Can you please take a look?

Yes. Sorry for the long answer. Lot of work lately.

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks again for the quick cycle!

@srebhan
Copy link
Copy Markdown
Member

srebhan commented Jun 2, 2021

@Kuzyashin looks like you need to resolve the conflict... :-)

Copy link
Copy Markdown
Contributor

@reimda reimda left a comment

Choose a reason for hiding this comment

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

Thanks!

@srebhan
Copy link
Copy Markdown
Member

srebhan commented Jun 2, 2021

@Kuzyashin the majority of the CI tests failed. Can you please take a look and fix the problem if there is any?

Edit: There seems to be a close-bracket missing in the test. :-)

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jun 2, 2021
@reimda reimda merged commit 58a9078 into influxdata:master Jun 3, 2021
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/configuration feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Environmental Variable To Fetch Config from URL

5 participants