X
X
Xip
Search…
Environment Variables
Tips for streamlining your environment variable management during development.
Environment variables (ENV Vars) will likely be an important part of your configuration. Each message platform component, NLP component, and others will likely require one or more API keys.
Most production environments will provide a way for you to specify your production keys. But for development, we recommend using the dotenv gem. This gem will allow you to specify a .env file in your bot repo from where you can set all of your environment variables.
Xip will automatically exclude the .env file from git.

Configuring dotenv in Xip

Add the dotenv gem to your Gemfile:
1
group :development do
2
gem 'foreman'
3
gem 'listen', '~> 3.3'
4
gem 'dotenv'
5
end
Copied!
Install the gem:
1
bundle install
Copied!
Load dotenv on boot via boot.rb:
1
require 'xip/base'
2
if %w(development test).include?(Xip.env)
3
require 'dotenv/load'
4
end
5
require_relative './environment'
Copied!
You'll be adding Lines 2-4 right below Line 1 which will already be there.
That's it! Now you can specify your environment variables via the .env file:
1
FACEBOOK_VERIFY_TOKEN=some_value
2
LUIS_APP_ID=1234
3
LUIS_ENDPOINT=your_endpoint.cognitiveservices.azure.com
4
LUIS_SUBSCRIPTION_KEY=xyz1234
Copied!
Last modified 9mo ago
Copy link