---
title: Connect hosts to your account
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/connect-hosts-your-account
---

You can control which hosts connect to your account by using environment-specific settings in the New Relic agent configuration file. You can set some configuration properties for all of your environments or modify them for an individual environment. For more information about the config file and where to find it, see the [configuration documentation](https://docs.newrelic.com/docs/site/configuring-the-agent) for your agent.

## Default settings [#default]

Many New Relic customers use a common configuration across multiple environments (for example, staging and production), but they may only run New Relic on hosts in one of those environments. You can use environment-specific settings to isolate which hosts report to New Relic.

Default settings for common environments appear at the bottom of the configuration file. Here is an example for production and staging:

```ruby
staging:
  <<: *default_settings
  app_name: <%= app_name %> (Staging)

production:
  <<: *default_settings
```

## Customized settings [#customized]

You can edit these settings as needed. You can also add custom environment sections for unique situations. For example, [YAML](http://en.wikipedia.org/wiki/YAML%23Data_merge_and_references "Link opens in a new window") provides node references ( `*` ) and hash merges (`<<`) that refer to a node labeled with an anchor (`&`) tag. The New Relic agent's default configuration file ships with common configuration options set to the `&default_settings` tag, but you can create your own to share configuration options across environments.

To control which hosts may connect to your account, set `monitor_mode` to true or false in the appropriate environment. To have your staging hosts connect to one account and your production hosts connect to another account, set the `license_key` in each environment according to how you would like to have them connected. As you can see in the screenshot above, you can also set the `app_name` and any other setting you may want specific to a given environment.

## Environments

The New Relic agent determines the environment where it's running. For example, Ruby uses the standard `RAILS_ENV` environment variable for Rails applications.
