A common strategy for managing sensitive data such as API keys is to set
them in the environment prior to starting a program that needs access to
them. Then the program can read from the environment variable at runtime.
This commit enables a similar strategy to work with libhoney out of the
box. If no writekey is supplied to Libhoney::Client it will check to
see if the HONEYCOMB_WRITEKEY environment variable is set. If it is it
will use that, otherwise it will use the empty string like it did
before.
No worries if this is something that you'd envision being handled outside of the gem! It's just something I've seen handled inside in the gem in the past, and I found myself missing it when I reached for it.
@eanakashima Thanks for the feedback! Good point about the need to set the dataset name. I'll close this PR and open a new one that changes the README. :)
A common strategy for managing sensitive data such as API keys is to set them in the environment prior to starting a program that needs access to them. Then the program can read from the environment variable at runtime.
This commit enables a similar strategy to work with libhoney out of the box. If no
writekey
is supplied toLibhoney::Client
it will check to see if theHONEYCOMB_WRITEKEY
environment variable is set. If it is it will use that, otherwise it will use the empty string like it did before.No worries if this is something that you'd envision being handled outside of the gem! It's just something I've seen handled inside in the gem in the past, and I found myself missing it when I reached for it.