paris93
paris93

Reputation: 212

why symfony puts "parameters.yml" in .gitignore file by default?

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

Upvotes: 0

Views: 643

Answers (2)

Barkati.med
Barkati.med

Reputation: 630

Because this file it's going to be generated from parameters.yml.dist when you run composer Update

Upvotes: 0

Matt S
Matt S

Reputation: 15364

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.

Upvotes: 3

Related Questions