你如何处理源代码管理中的配置文件? [英] How do you deal with configuration files in source control?
问题描述
我在做什么过去是有一个默认配置文件签入到源代码管理。然后,每个开发人员都有自己的覆盖配置文件,该文件从源代码管理中排除。应用程序首先加载默认值,然后如果覆盖文件存在,加载它并使用覆盖的任何设置,优先于默认文件。
通常,覆盖文件越小越好,但对于具有非标准环境的开发人员,它总是可以包含更多设置。
Let's say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be a dev, prod and stage versions. How do you deal with this in source control? Not check in this file at all, check it with different names or do something fancy altogether?
What I've done in the past is to have a default config file which is checked in to source control. Then, each developer has their own override config file which is excluded from source control. The app first loads the default, and then if the override file is present, loads that and uses any settings from the override in preference to the default file.
In general, the smaller the override file the better, but it can always contain more settings for a developer with a very non-standard environment.
这篇关于你如何处理源代码管理中的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!