datarockets / rails_apps_composer

A gem with recipes to create Rails application templates for Rails starter apps.
http://railsapps.github.io/rails_apps_composer/
0 stars 0 forks source link

Environment variables #20

Open AleksSenkou opened 7 years ago

AleksSenkou commented 7 years ago

Conversation

Add gem and file for environment variables?
          1)  None
          2)  Add .env with Foreman

Purpose

Use dotenv gem + .env file + initializers by default

Checklist for changes:

RAILS_ENV=development


* [x] Add script to `setup` script(copies vars from env sample file to env):
```ruby
  unless File.exist?(".env")
    cp ".env.sample", ".env"
  end

def try_to_add_new_env_vars env_file = File.read('.env')

File.open('.env', 'a') do |file| env_sample_vars.each do |var_name, var_definition| file << var_definition unless env_file.include?(var_name) end end end

if File.exist?(".env") try_to_add_new_env_vars else cp ".env.sample", ".env" end



More info about `setup` and `update` scripts [here](https://github.com/datarockets/rails_apps_composer/issues/19)

###### P.S. Ping me if you are not agree, or have better idea.

* [ ] Check figaro gem, and update if this will be necussary:
roman-dubrovsky commented 7 years ago

@AleksSenkou 👍

MProG commented 7 years ago

@AleksSenkou I think https://github.com/laserlemon/figaro is better. Please investigate this gem too

AleksSenkou commented 7 years ago

@MProG can we close this issue?

MProG commented 7 years ago

@AleksSenkou Not now. I want check how work figaro