douhe2305 2018-12-05 16:38
浏览 189

Symfony 3.4使用parameters.yml中的变量覆盖env变量

I have the following setup which appeared to work for some time: environment variables like TEST=1 and defined defaults in parameters.yml, according to the config:

    env(TEST): 2

When I go to console and output the container params, it's always the value from parameters.yaml:

bin/console debug:container --parameters | grep env
env(TEST) 2

I also tried doing exactly as it's said in the docs:

TEST: "%env(TEST)%"
env(TEST): 2

Now when I dump the parameters, I have both of them:

bin/console debug:container --parameters | grep env
TEST %env(TEST)%
env(TEST) 2

To be more precise: I use docker setup, and printenv inside a container gives me my TEST=1 shown.

Can someone explain me what happens/happened here? It's been working for some time, and then, probably after some major update, got broken.

I tried debugging it and got to a very strange place in Symfony sources:

At that very line, there's a value "2" being passed, and it doesn't meet the conditions and gets returned.

  • 写回答

1条回答 默认 最新

  • douyin7829 2019-01-21 14:14

    Looks like everything works correctly - it's just the parameter debug output that confused me.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 qt中connect两个signal
  • ¥20 pix2pixHD运行测试命令时出现数据类型错误无法反向传播的问题
  • ¥15 python处理Excel符合条件的行自动填写数据分类
  • ¥15 汇编hook举例并讲解(通俗易懂,学习用)
  • ¥20 用c++语言模拟键盘电子琴设计
  • ¥15 STM32cubemx生成keil工程,有问题与正常的情况不同,求解!
  • ¥15 如何自动点击银行app的安全键盘,实现密码自动输入
  • ¥15 关于四边形重叠的问题
  • ¥15 用verilog语言设计一个简易的八音符电子琴,可通过按键输入来控制音响。演奏时可以选择是手演奏(由键盘输入)或自动演奏已存入的乐曲。能够自动演奏多首乐曲,且每首乐曲可重复演奏
  • ¥15 sap gui脚本每次到导出Excel的时候就停住不动。不会另存为。