How do you keep secrets.yml secret in rails?

后端 未结 4 519
猫巷女王i
猫巷女王i 2021-02-03 12:28

I\'m pretty new to rails, but I have some experience programming in PHP and other languages. I really like rails, and I\'m working on an application for my company, but I still

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 12:46

    First off, I always add all .yml files to my .gitignore file, like this:

    *.yml
    

    This serves to keep any configuration files off of git. However, I also create "distribution files" to keep on git. Basically, clone somefile.yml to somefile.yml.dist and remove the actual values, but keep the structure/keys intact, so anyone else using your code can "fill in the blanks" themselves.

    Keeping your development/test secrets secret isn't that important, as long as they differ from your production secrets. Some secrets (like if you are using Cloudinary) are the same for all environments, so you don't want to share those.

提交回复
热议问题