Committing Machine Specific Configuration Files

后端 未结 10 1504
我在风中等你
我在风中等你 2020-11-22 06:43

A common scenario when I develop is that the codebase will have several config files which require machine specific settings. These files will be checked into Git and other

10条回答
  •  深忆病人
    2020-11-22 07:28

    Check in a default configuration with a different extension (say .default), use a symlink to symlink the default to the correct location, add the correct location to .gitignore, and add everything else related to the configuration to .gitignore (so the only thing that gets checked in is config.default).

    Additionally, write a quick install script that sets up the symlinks for your application-wide.

    We used a similar approach at a previous company. The install script autodetected what environment you were running in (sandbox, development, QA, production), and would automatically do the right thing. If you had a config.sandbox file, and were running from the sandbox, it would link that (otherwise it would just link the .defaults file). Common procedure was to copy .defaults and change settings as necessary.

    Writing the install script is easier than you might imagine, and gives you a lot of flexibility.

提交回复
热议问题