Magento 实时和暂存的不同配置文件
网站的 live、staging 和 dev 版本是否可以有不同的 config.xml 文件。
我认为应该有一个 live.xml、local.xml 和 staging.xml,这些应该设置一次,然后通过 htaccess 环境变量或其他东西进行控制
这可能吗?
Is it possible to have different config.xml files for live, staging and dev versions of the site.
Im thinking that there should be a live.xml, local.xml and staging.xml and these should be set up once and then controlled via htaccess environment variable or something
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,Magento 不支持开箱即用的功能,而且据我所知,没有任何模块可以提供此功能。
如果您愿意,您可以实现此版本。 Magento 的所有配置文件都是(或者应该是,别让我坚持)通过
Mage_Core_Model_Config
类加载。您可以为此模型创建一个类重写,该重写将根据环境更改 $filename,然后加载适当的配置文件。
虽然这是一个有趣的想法,但我认为这不是一个好主意。环境差异应该在部署级别上处理,并且模块的 config.xml 文件中无论如何都不应该包含任何特定于环境的信息。特定于环境的信息保存在一个位置
您的构建/部署系统应根据需要根据您要部署到的环境修改 local.xml。
No, nothing supports this out of the box with Magento, and there's no module I know of that offers this functionality.
You could implement a version of this if you wanted to. All of Magento's config files are (or should be, don't hold me to it) loaded via the
Mage_Core_Model_Config
class.You could create a class rewrite for this model that would alter the $filename based on environment, and then load the appropriate configuration file.
While it's an interesting idea, I don't think it's a good one. Differences in environment is something that should be handled on a deployment level, and a module's
config.xml
file shouldn't have any environment specific information in it anyways. Environment specific information is kept in one locationYour build/deploy system should modify local.xml as needed depending on which environment you're deploying to.