Git Product home page Git Product logo

dotenv-deployment's Issues

Unicorn in Production

It seems that environment is set to RACK_ENV which is 'deployment' when using unicorn. I prefer my .env to be named .env.production rather than .env.deployment so it might be better to prioritize Rails.env over RACK_ENV when Rails.env is available.

Lack of .env files in config/** reverts any .env.#{environment}

In a Rails app, if there are no .env files in config/**/, dotenv adds (and parses) the root .env file, reverting any overrides in .env.#{environment}

For example:

# in /.env
FOO=root

# in /.env.development
FOO=dev
Dotenv.load '.env'
pp ENV['FOO']
# > "root"

Dotenv.overload ".env.#{environment}"
pp ENV['FOO']
# > "dev"

Dotenv.overload *Dir.glob("#{Rails.root}/config/**/*.env.#{environment}")
pp ENV['FOO']
# > "root"

The glob call returns an empty array which is then backfilled with .env in Dotenv#with. This means that the non-environment specific file is not only parsed twice, it reverts anything that is overridden in .env.development

Deployment code doesn't work when trying to override DATABASE_URL

I need to load dotenv before I can boot my rails application. As such, I can't call Rails.root without getting a nil response. It would be useful for me to be able to use dotenv-deployment and pass a path to the configuration directory to glob instead of chaining off of Rails.root.

For now, I'll basically copy/paste deployment.rb.

Unable to load file in config repository

Hello,

I was struck while trying to load my dotfile in the config directory.
I took a quick look at the gem code and found out that the Dir.glob command is not used properly.

This is how it's used today in the Gem

Dir.glob("#{Rails.root}/config/**/*.env.#{environment}"

But as it's written in the Doc, this won't find any Unix Dotfile.

Note, this will not match Unix-like hidden files (dotfiles). In order to include those in the match results, you must use the File::FNM_DOTMATCH flag or something like "{,.}".

But if do this it will work

Dir.glob("#{Rails.root}/config/**/{.env.#{environment}}")

Can you give me your feedback ?

Regards.

Clarify in README that dotenv gem is still required

I was confused for a bit because my .env file wasn't being loaded. I assumed the dotenv gem was a dependency of the dotenv-deployment gem but I guess it wasn't. You should clarify in the README that both dotenv-deployment AND dotenv have to be added to the Gemfile before things work as expected.

Dependency confusion

dotenv-deployment requires dotenv to function, so I think it should have dotenv as a dependency. However, dotenv itself has dotenv-deployment as a dependency, so doing that results in a circular dependency.

The README seems to say that if I want dotenv-deployment stuff, then I should include the dotenv-deployment gem, but you can't just use dotenv-deployment by itself, you have to include dotenv. Confusing...

Can you clarify what should be happening? Thanks!

"Auto-loading of `.env.test` will be removed" if gems are listed in wrong order

Got this:

Auto-loading of .env.test will be removed in 1.0. See https://github.com/bkeepers/dotenv-deployment if you would like to continue using this feature.

When my Gemfile had:

gem 'dotenv-rails'
gem 'dotenv-deployment'

Went away when I changed that to:

gem 'dotenv-deployment'
gem 'dotenv-rails'

And you can't just list dotenv-deployment on its own since it doesn't depend on dotenv-rails (maybe it should?).

I would suggest either making them order-independent if possible, or else documenting that the order is important.

Globbing doesn't work because Rails.root is nil

Not sure what's going on, but in our Rails 4.1.4 app, dotenv-deployment won't find files under config because it sees Rails.root as empty.

If I modify the lib to do p lib: Rails.root after if environment โ€ฆ and then run this:

spring stop; rails runner 'p runner: Rails.root'

I see this output:

Spring stopped.
{:lib=>nil}
{:runner=>#<Pathname:/Users/henrik/Projects/my_app>}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.