L
L
Lakewake2012-03-06 23:19:00
git
Lakewake, 2012-03-06 23:19:00

Git site local + remote + settings file

Help to understand the solution of the situation:

There is a production server, there is a local machine.
On the local machine, there is AMP on which the site is being tested.
Used by git to push to production.

The site has a Settings.php settings file, which contains, among other things, connections to the database.
Accordingly - for the local machine one, for production - others.
The settings file itself, in addition to accessing the database, contains a bunch of settings that often change.

How to solve a problem in Git such that locally one data for the database, and locally test during development, and in production - others?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vlad Frolov, 2012-03-07
@vedmaka

I don’t know the best practice for PHP, but in Python I do this: the local_settings file is imported into settings and the local_settings file is added to .gitignore

A
Anton Taraev, 2012-03-07
@ataraev

Split the configuration into several files and ignore the base configuration file.

V
Vladimir Chernyshev, 2012-03-07
@VolCh

Implement settings inheritance. For example, in settings.php include settings_default.php and overwrite local settings. add settings.php to .gitignore.

D
deadkrolik, 2012-03-07
@deadkrolik

You can write a hook that substitutes the desired configuration file after push. It's not difficult at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question