Setting Environment Variables

There are three ways to set environment variables for tests:

Checked in to your Repo

For persistent configuration that isn’t sensitive, you can pass environment variables to your tests via config/solano.yml by adding an environment section. This section must be a hash mapping environment variable names as strings to values, which must also be strings. These environment variable settings will be exported to all tests.

environment:
  'VARIABLE': 'value'

Via Config Variables

For sensitive configuration info that you can’t check in to your repo, or for variables that should not branch, you can use the solano config command to store variables in your account that will be passed through to your build when it runs.

$ solano config [SCOPE=suite]              # Display for SCOPE
$ solano config:add [SCOPE] [KEY] [VALUE]  # Set KEY=VALUE at SCOPE
$ solano config:remove [SCOPE] [KEY]       # Remove config variable NAME from SCOPE

The solano config command allows for setting environment variables at three scopes:

  • org - applies to all repos and branches in your organization
  • org:ORGNAME - applies to all repos and branches in organization ORGNAME
  • repo - applies to a all branches of a repo
  • suite - applies to a single branch of a repo

Configuration is merged hierarchically.

A suite-level setting overrides an account-level setting. We will soon roll out a repo-wide configuration level.

Environment variables set in config/solano.yml override all other settings.

Run solano help config for more information on usage.

Third Party Integrations

Some third party integrations will automatically set config variables:

  • Github: GITHUB_OAUTH_TOKEN – Note that Github OAuth tokens are set account-wide by the owner and may be overriden on a repo-by-repo basis. See Github Linkage for details.
  • New Relic: NEW_RELIC_API_KEY, NEW_RELIC_APPLICATION_ID
  • Code Climate: CODECLIMATE_REPO_TOKEN