-
-
Notifications
You must be signed in to change notification settings - Fork 514
Variables from .env not being loaded #199
Description
I'm trying to use dotenv to run a Sinatra-based application locally ( https://github.com/FlorianZ/hadashboard -- built on Dashing) but am not having any success. Note that I'm more of a Python person and am pretty rusty on Ruby.
I've installed the dotenv gem and have added it to my Gemfile as described in the README (see my Gemfile below). I've also tried it without the :groups qualifiers.
I then added it to the "config.ru" file, which is where I understood it to belong as far as adding it to the bootstrapping process of the app:
require 'omniauth-heroku'
require 'dashing'
require 'dotenv'
# Load environment variables using Dotenv. If a .env file exists, it will
# set environment variables from that file (useful for dev environments)
Dotenv.load
...
However, even though I've added a .env file to my project root, when I start the server (using dashing start) it doesn't seem to be picking up any of the environment variables set in that file.
Gemfile:
source 'https://rubygems.org'
gem 'dotenv-rails', :groups => [:development, :test], :require => 'dotenv/rails-now'
gem 'eventmachine', '= 1.0.6'
gem 'dashing'
gem 'thor'
# Authentication
gem 'oa-openid'
gem 'omniauth-heroku', '~> 0.2.0.pre'
gem 'oauth2'
# JSON
gem 'json'
# Database
gem 'data_mapper'
# Development
group :development do
gem 'dm-sqlite-adapter'
end
# Production
group :production do
gem 'dm-postgres-adapter'
end
There are no errors when running the application, except for those caused by my environment variables being empty. Any help would be appreciated. Again, talk to me like I haven't touched Ruby in 8 years. Because I haven't. ;)