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

Accept API key as an argument #3624

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

istairbn
Copy link

@istairbn istairbn commented Jan 2, 2018

Note: Please remember to review the Datadog Contribution Guidelines
if you have not yet done so.

What does this PR do?

Allows a user to pass in the Datadog API key to the install script as an argument rather than as an environment variable.

Motivation

Trying to get the agent to install using AWS SSM was proving troublesome. Despite exporting the variable correctly, I kept getting the "API key not available in DD_API_KEY environment variable" message. Plus, it seemed a little odd to go through two steps (create variable, run script) when you could do it in a single step (script plus argument). As it appears it's the only external input required, it seems sensible you should be able to put the key in that way! Environment variables take precedence and a blank still throws an error to alert people.

Testing Guidelines

It's a 3 line edit to the Agent Installer. The old use case, failure case and this all work.

Additional Notes

I didn't upgrade the error message (it still implicitly expects an Environment Variable) as I assume you want that to be the primary method of injecting the key.

Trying to get the agent to install using AWS SSM was proving troublesome. This allows the user to pass the variable directly to the script, making the one liner even more one-linerier
@istairbn
Copy link
Author

istairbn commented Jan 2, 2018

Here's an example of what I was trying to achieve (indeed, this works because it uses my branch).
https://gist.github.com/istairbn/bbe46df601c78778a834ba78f136c2f2
I had the example script in there and it kept failing on me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants