管理复杂的配置

发布于 2024-09-11 16:30:53 字数 156 浏览 4 评论 0原文

我想询问您对管理大量复杂(例如 xml、.properties、自定义格式等)配置文件的最佳实践的看法,因为现在每个更复杂的项目都包含大量的配置文件。

如何在如此混乱的环境中不迷失方向?如何以最佳方式重用它们?有什么好的工具可以提供帮助吗(也许是一些基于 Eclipse 的工具)?

I would like to ask you for your opinion on the best practices of managing big numbers of complex (for example xml, .properties, custom formats etc) configuration files as nowadays every more complex project consist of way to many to count.

How not to get lost in such a mess? How to reuse those in best ways? Any good tool that can help (maybe some Eclipse based)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

久随 2024-09-18 16:30:53

显然,最基本的事情是将这些配置文件放入源代码管理中,因为它们实际上是一种源代码。

但配置管理的真正挑战是决定有多少文件以及将哪些文件放在哪里,以便您可以重用通用配置。这些是设计决策,并且非常特定于项目和环境,没有任何工具可以为您做出这些决策。

一种常见的方法是拥有一个包含默认值的主配置文件,以及仅包含与其环境不同并覆盖默认值的配置值的特定于环境的文件。这是作为自动构建过程的一部分发生的(您真的非常应该这样做)。

Obviously, the most fundamental thing to do is to put those configuration files into source control, as they really are a kind of source code.

But the real challenge with configuration management is deciding how many files to have and what to put where so that you can reuse common configurations. Those are design decisions and very project- and environment-specific, and no tool can make them for you.

A common approach is to have a master config file that contains default values, and environment-specific files that contain only those config values that are different for their environment, and which overwrite the defaults. This happens as part of an automated build process (which you really, really should have).

铃予 2024-09-18 16:30:53

我不确定这是否适用于您的情况,但我会尝试以标准化方式将它们全部存储在数据库中。也许您需要一个可以编写一些导入工具来从文件中获取信息并将它们添加到数据库中。

或者阅读,或可能对您有帮助。

I'm not sure if this would be applicable to your situation, but I'd try and store them all in a database in a normalised fashion. maybe you need a could write some import tools that grabs the info from the files and adds them to the db.

Alternativly reading this, or this might help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文