Questions tagged [ruby-dotenv]

A Ruby gem for storing application configuration in plain text files.

Code repository: https://github.com/bkeepers/dotenv

12 questions
35
votes
6 answers

Is it possible to store a JSON file to an ENV variable with dotenv?

I am using Google Drive API with my Rails application. The API is working fine. I have the following client_secret.json file: { "type": "service_account", "project_id": "gobirdie-landing-page", "private_key_id": "xxxxx", "private_key":…
Quentin P.
  • 373
  • 1
  • 3
  • 7
6
votes
2 answers

dotenv gem doesn't get variables in Rails 6 or Ruby 2.6.5

I was using the dotenv gem to store environmental variables for development in a secrets file. The gem is no longer pulling the variables after upgrading ruby and rails on my computer. To try and track down the cause, and after a while of trying…
4
votes
3 answers

Does dotenv override envvars set by docker compose?

I'm not familiar with Docker or devops, but I have these files: .env.production DO_NOT_SEND_EMAILS=false docker-compose.ci.yml services: my-app: environment: - DO_NOT_SEND_EMAILS=true Both files contain more than that, but these are…
Mirror318
  • 11,875
  • 14
  • 64
  • 106
3
votes
1 answer

Heroku local byebug / debugger broken

I've been using the Heroku Toolbelt's "Heroku local" command in order to load environmental variables locally. However, this breaks byebug. I am not able to get to a (byebug) prompt when using the Heroku local command. As a result, I'm forced to…
2
votes
2 answers

Rails 6: some environment variables not loading via dotenv in console

I'm creating a new application in Rails 6, and the workflow for keeping secrets in our other Rails apps (anywhere from 4.x and 5.2) was to create an .env file and import them through the dotenv gem, and then have config/secrets pull from the ENV…
Lee Wang
  • 46
  • 5
2
votes
1 answer

How to set different environment variables for test and development when using Foreman

Currently I store sensitive information (e.g. API keys) in a .env file that is loaded by the Foreman gem. This works well and I am able to access environment variables that are the same in both development and test. I'd like to be able to use a…
Cyrus
  • 3,687
  • 5
  • 35
  • 67
2
votes
0 answers

Dotenv not availabe in routes.rb?

eversince I started using Dotenv inside my routes.rb I get weird errors. I'm using gem 'dotenv-rails', '~> 2.0.0' routes.rb: constraints(host: ENV.fetch("SHORTENER_DOMAIN")) do get ':id', to:…
Cojones
  • 2,930
  • 4
  • 29
  • 41
1
vote
1 answer

Environment Variables get Trimmed with "$" in it

So I have an environment variable in my .env file. TESTMSG=abc$efg And in rails console when I try to retrieve this data, it gets trimmed and the part after & doesn't get printed. 2.6.0 :001 > ENV['TESTWORD'] => "abc" How to get the complete…
Nidhin S G
  • 1,685
  • 2
  • 15
  • 45
1
vote
1 answer

Does "vanilla" Ruby dotenv pick up any file other than .env?

I want to use environment-specific variables in my non-Rails Ruby application. I tried different file names like .env.test.local, .env.local, .env.test I tried using the Dotenv.load and require 'dotenv/load' approaches This is how I wrap the…
Mario Gil
  • 493
  • 1
  • 5
  • 14
1
vote
2 answers

how to not require certain gems/lines of code in production that I need in development

I am not writing in Rails. It is just ruby. But I have a dev environment that has it's own development group in the Gemfile. But I don't use them in production on Iron.io. In particular, I use "log_buddy" and have lots of d {var} statements…
Satchel
  • 16,414
  • 23
  • 106
  • 192
0
votes
1 answer

500 Internal Server Error - Aws::S3::Errors::AccessDenied - CarrierWave

I am trying to upload images to S3 via CarrierWave but keep getting a 500 Internal Server Error - Aws::S3::Errors::AccessDenied. I am using the ruby gem CarrierWave to configure AWS and dotenv-rails to call and hide my credentials in a .env file. It…
0
votes
2 answers

cant get environment variables from file working in fastlane

Trying to follow examples and docs from fastlane regarding env vars and dotenv files, but I cant get any ENV variables to work in fastlane. My Fastfile has this to test a variable usage: lane :test do var1 = ENV["CRASHLYTICS_API_TOKEN"] puts…
stonedauwg
  • 1,328
  • 1
  • 14
  • 35