I want to install New Relic on one of my open source rails applications (v 3.2.12). I don't want to have the license key in the repo. I'd like to load it with something like ENV.
By default that's loaded in the newrelic.yml
file.
Where is that YAML file loaded? I guess I could manually merge it with a hash that loads the license from the ENV hash.
Any hints on how to do that?
Before installing infrastructure, be sure to: Review the requirements. Have a valid New Relic license key. To install infrastructure in Linux, follow these instructions: Create the configuration file and add your license key:
The license key is a 40-character hexadecimal string associated with a New Relic account. When you first sign upfor New Relic, an organization with a single account and its own license key are created. If more accounts are added, each account starts with its own license key.
Either way, you'll need a New Relic account if you don't have one. (It's free, forever.) Get an account Guided install EU guided install Step-by-step instructions If guided install doesn't work, you can install the agent manually.
You should install the newrelic-infra package as root, privileged mode, or unprivileged mode if you don’t want to share the user’s identity. How Do I Install New Relic Agent On Windows?
I use the Figaro gem to handle secret keys with ENV
environment variables, similar to you. For New Relic, I have:
config/application.yml (.gitignore
d and not pushed to source control)
# ...
NEW_RELIC_LICENSE_KEY: {{MY_KEY}}
which is then referenced in config/newrelic.yml:
# ...
license_key: <%= ENV['NEW_RELIC_LICENSE_KEY'] %>
A file called config/application.example.yml gets pushed up to the source code repo with instructions to put your own license key in:
config/application.example.yml
# ...
NEW_RELIC_LICENSE_KEY: # put your license key here
Also see this StackOverflow Q&A for more details:
What should be removed from public source control in Ruby on Rails?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With