Environment variables on production

后端 未结 3 1237
长情又很酷
长情又很酷 2021-01-05 20:25

I’m currently deploying my Rails application on Amazon and I’m facing a problem with environment variables.

I\'m using the dotenv gem on development and testing and

3条回答
  •  迷失自我
    2021-01-05 21:20

    The dotenv-deployment readme mentions how you can use it in a production environment:

    If you're using Capistrano 3+:

    Just add .env to your list of linked_files:

    set :linked_files, %w{.env}
    

    If you're using Capistrano 2.x.x version:

    In your config/deploy.rb file:

    require "dotenv/capistrano"
    

    It will symlink the .env located in /path/to/shared in the new release.

    Remember to add :production group to the dotenv-rails gem in your application's Gemfile:

    gem 'dotenv-rails', :groups => [:development, :test, :production]
    

提交回复
热议问题