gpt4 book ai didi

php - 设置每个环境的 bolt 配置

转载 作者:可可西里 更新时间:2023-11-01 00:42:18 25 4
gpt4 key购买 nike

Bolt documentation提到为每个环境设置配置文件,但没有解释如何实现。

When you have multiple environments for the same site, like development, staging, or production, you’ll want parts of the config to be the same, and some different per environment. You’ll probably have different database info and debug settings. This can be accomplished by splitting the config.yml file. Put all settings you share over all environments in the default config.yml, you can commit this in your version control system if wanted. Every setting which is different per environment, or which you do not want in version control (like database info), you put in config_local.yml. First config.yml is loaded and then config_local.yml, so that config_local.yml can override any setting in config.yml.

当然,我创建一个额外的配置文件没有问题,但是我如何告诉 Bolt 它正在运行哪个环境以及它应该加载哪个文件?

最佳答案

原来 Bolt 完全不知道它的环境。它总是加载 config.yml 后跟 config_local.yml,无论域名是什么。

从 Config.php,从第 226 行开始:

protected function parseGeneral()
{
// Read the config and merge it. (note: We use temp variables to prevent
// "Only variables should be passed by reference")
$tempconfig = $this->parseConfigYaml('config.yml');
$tempconfiglocal = $this->parseConfigYaml('config_local.yml');
$general = Arr::mergeRecursiveDistinct($tempconfig, $tempconfiglocal);

我的问题的解决方案是永远不允许部署 config_local.yml。

关于php - 设置每个环境的 bolt 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31897827/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com