How do I open source my Rails' apps without giving away the app's secret keys and credentials

后端 未结 5 1569
[愿得一人]
[愿得一人] 2020-12-13 07:38

I have a number of Rails apps hosted on GitHub. They are all currently private, and I often will deploy them from their GitHub repository. I\'d like to be able to make some

5条回答
  •  天涯浪人
    2020-12-13 07:59

    I recently went through this with one of my own apps. My solution was to store anything secret in a git-ignored YAML config file, and then to access that file using a simple class in the initializers directory. The config file is stored in the 'shared' folder for the Capistrano deployment and copied to config at each deploy.

    Config store: http://github.com/tsigo/jugglf/blob/master/config/initializers/juggernaut.rb

    Example usage: https://github.com/tsigo/jugglf/blob/6b91baae72fbe4b1f7efa2759bb472541546f7cf/config/initializers/session_store.rb

    You may also want to remove from source control all history of the file that used these secret values. Here's a guide for doing this in Git that I used: http://help.github.com/removing-sensitive-data/

提交回复
热议问题