Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Daniel Libanori
@dlibanori
Both apps run with RAILS_ENV=production.
So I can’t use dotenv. But, if I could get a file from web I have just to set the file location as “user data” when I spawn EC2 instance.
Then I can have same image running with another vars (.env)
Daniel Libanori
@dlibanori
What do you guys think about?
Brandon Keepers
@bkeepers
@dlibanori I think it’s an interesting option. I would be hesitant to have a deploy-time dependency on another web service, unless it’s one that you have a lot of control over.
Daniel Libanori
@dlibanori
@bkeepers nice. Acout deploy-time dependency, at least for me, it will not be a problem, all my servers are at amazon
Brandon Keepers
@bkeepers
@dlibanori at GitHub, we manage configuration in a repository that gets deployed to servers separate from the application. This allows us to revision our config changes, keep config separate from code, and still gives a lot of flexibility for configuration between different environments
Daniel Libanori
@dlibanori
yes, but you do not use same image for test and production, right?
Brandon Keepers
@bkeepers
same app image? yes, but different configurations get deployed
Daniel Libanori
@dlibanori
but if you filesystem change you got another image
when I am talking about image I am talking about whole hard disk
no just app
Daniel Libanori
@dlibanori
I love dotenv, but as my team get bigger it is getting harder to keep .env file synchronized. If a developer add one var he has to warn everybody to update their env.local.
Stefan Huska
@kelso
Hi, in README is gem 'dotenv-rails', :groups => [:development, :test] - my question is how this is working in production mode when it's only in dev and test groups?
linux/ubuntu is loading .env by default?
Brandon Keepers
@bkeepers
@dlibanori that is the reason I recommend committing dev-only values in .env
@dlibanori my general rule is that anyone should be able to clone the repo, run script/bootstrap, and script/server and the app just works
@kelso if you want to use dotenv in development/test, you have to remove the :groups => … part
Aleksey Ivanov
@ivanovaleksey
@kelso +1 I do not understand why it should be :groups => [:development, :test]. What about production?
Anam mansoor
@aslaslasal_twitter
Hello
I want to setup same variable for development and test

DEVELOPMENT:
CORE_API_URL = 'coreapi.com'

TEST:
CORE_API_URL = 'coreapi.test'

something like this
How can I achieve this in
dotenv
Anam mansoor
@aslaslasal_twitter
Figured it out
Loading a .env.test file in in spec helper
Rolando Brown
@rolandobrown
Hi everone! @bkeepers has anyone shared experience using "dotenv' gem in a Podio environement? Running into this bug: https://gist.github.com/rolandobrown/9054fc966e40316a55b0e4769a432d71
Admazzola
@admazzola
Im just getting set up and im getting a { Could not authenticate you from GitHub because "The redirect uri must match the registered callback url for this application.". } when i try to sign in via github oauth
My github callback config is set to https://____.com/users/auth/github/callback
there is nowhere on github to set up a callback url soooo im not sure whats wrong
OH I JUST FIXED IT ! You have not be sure NOT to put in https in the github oauth config, it has to be http !! Even if you are using TLS
umangnaik107
@umangnaik107
guys i am from india i am new to ruby on rails and gem i need to learn implementation of gem without using scaffold which is the best way to understand mvc concept too
@admazzola
Denis Oster
@denisoster
image.png
Help please
Matt Voska
@voska
I'm having a very odd issue here.
I added dotenv to my Gemfile under the dev & test group. I setup my .env file but I kept getting the error that my variables were nil. I went to rails console and checked the variables - nil. I manually loaded dotenv and then my variables came up as expected. So I tried adding Dotenv::Railties.load to my application.rb file and then I got an uninitialized constant error
Any idea what's going on here? I'm sure it must be something simple
Matt Voska
@voska
Figured out my issue.
--Gemfile--
gem 'dotenv' -> gem 'dotenv-rails' facepalm
Zach Dennis
@zdennis
Doh! Been there @voska! Glad you figured it out.
Sean Manton
@sxmanton

I'm experiencing a bit of a headscratcher... I have a class in a Rails application where I have a constant defined, i.e.

class MyClass
    MY_CONST = ENV["MY_VAR"]
    puts MY_CONST

if I put MY_VAR in .env, the value is properly loaded, but if I put it in .env.development.local, it ends up as nil. Is this expected behavior? Based on my understanding, since the class is getting created before application.initialize, I would expect it to not work whether I put it in .env or .env.development, if I don't call Dotenv.Railtie.load prior to defining MY_CONST.

Zach Dennis
@zdennis
@sxmanton, have you verified that your class is indeed loading before dotenv is loading? Also, your local shell environment doesn't have MY_VAR set does it?
And are you indeed using dotenv-rails as opposed to just dotenv gem?
Sean Manton
@sxmanton
@zdennis yeah, using dotenv-rails. Variable is definitely not set in local shell. If I do a puts ENV["MY_VAR"] in the Application class, the puts in MyClass occurs first, then the one in Application. When MY_VAR is defined in .env, it shows up correctly in both puts statements, when it is in .env.development, it has no value in MyClass but does have the correct value in Application
Dmitry Zolotnikov
@spbkelt

hello guys
i have a problem with my rails app and dotenv, i cannot read values from .env in the app root
who can help me out?

it reads from shell env vars, but not from the .env file . i need to read RAILS_ENV variable and set it to Rails.env automatically or explicitly

so the goal is to use proper environment depending on RAILS_ENV which we read from env specific file

what i did
1) added gem "dotenv-rails" to Gemfile
2( bundle install
3) added explicit Dotenv::Railtie.load to config/environment.rb

Test command: bundle exec rails c

it shows me development. But i expect staging cause i have this in <root>/.env
RAILS_ENV=staging

thanks!

It works for rake tasks. But not for rails
I have rails gem "rails", "5.2.3"
ruby -v ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux-gnu]