ruby on rails - Application pushed to heroku but not working due to dotenv gem -
i have pushed heroku application not run. see due dotenv gem. there way around this? need dot-env gem in order encrypt basic auth user name , password. i'd prefer not use devise or of complexity simple application.
below heroku terminal output, issue dont know how spot errors/read output.
/app/config/application.rb:4:in `require': cannot load such file -- dotenv (loaderror) /app/config/application.rb:4:in `<top (required)>' /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:141:in `require' /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!' /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:67:in `console' /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!' /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>' /app/bin/rails:9:in `require' /app/bin/rails:9:in `<main>' gem 'rails', '4.2.5' gem 'pg' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'will_paginate', '~> 3.1.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem "font-awesome-rails" gem 'dotenv-rails', :groups => [:development, :test] gem 'will_paginate-bootstrap' gem "paperclip", "~> 5.0.0" group :development, :test # call 'byebug' anywhere in code stop execution , debugger console gem 'byebug' end group :development # access irb console on exception pages or using <%= console %> in views gem 'web-console', '~> 2.0' # gem 'dotenv-heroku' # spring speeds development keeping application running in background. read more: https://github.com/rails/spring gem 'spring' end
you configured dotenv
gem enabled development
, test
environments:
gem 'dotenv-rails', :groups => [:development, :test]
however, application started in production
environment in heroku. therefore, rails application crash because tries load gem it's not available.
you manually included dotenv
loading code somewhere in application:
dotenv::railtie.load
you need remove (as dotenv inject in load process, when gem loaded), or wrap code within conditional block executes if dotenv
defined
if defined? dotenv # .. end
unless need manually load library (and don't), remove explicit statement, explained in documentation.
dotenv initialized in rails app during before_configuration callback, fired when application constant defined in config/application.rb class application < rails::application. if need initialized sooner, can manually call dotenv::railtie.load.
Comments
Post a Comment