dongzi3434 2017-01-31 18:15
浏览 67
已采纳

为什么symfony默认将“parameters.yml”放在.gitignore文件中?

I'm starting with Git and Github for versioning my Symfony3 project and I was wondering why parameters.yml is in the .gitignore file by default? I'm changing that file so that my app connects to a PostgreSQL database.

My concern is that when others clone my project from GitHub and start contributing will it affect them to have the parameters.yml file missing?

Do I need to remove it from .gitignore?

If not when do I have to make it trackable?

Thanks for your answers

  • 写回答

2条回答 默认 最新

  • duanbu1421 2017-01-31 18:19
    关注

    From the docs:

    The default parameters.yml file... defines the options related to the database and mail server infrastructure.

    Each of your servers will have its own infrastructure configuration. No one who clones your project will be sharing your exact server configurations. You also don't want to publish your system credentials to the internet. So this file should be ignored by git.

    Instead you want to share a similar file for each user to set up their own parameters:

    Symfony includes a configuration file called parameters.yml.dist, which stores the canonical list of configuration parameters for the application.

    Whenever a new configuration parameter is defined for the application, you should also add it to this file and submit the changes to your version control system. Then, whenever a developer updates the project or deploys it to a server, Symfony will check if there is any difference between the canonical parameters.yml.dist file and your local parameters.yml file. If there is a difference, Symfony will ask you to provide a value for the new parameter and it will add it to your local parameters.yml file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题