Nginx Go:在模板中的if语句中使用环境变量

Nginx Go:在模板中的if语句中使用环境变量,nginx,go,go-templates,Nginx,Go,Go Templates,下面是我用于NGINX配置的Go模板代码。在嵌套的if语句中,我试图检查环境变量的值是否等于“true” 但是当我执行模板时,我得到以下错误: tenanttemplate.tmpl:13: unexpected \"{\" in operand" 我浏览了Go模板的在线文档和关于堆栈溢出的一些其他答案,但没有任何帮助。更改 {{ if eq ({{envOrKey "IS_CUSTOMER"}}) "true" }} 到 {{ if eq ({{envOrKey "IS_CUSTOM

下面是我用于NGINX配置的Go模板代码。在嵌套的if语句中,我试图检查环境变量的值是否等于“true”

但是当我执行模板时,我得到以下错误:

tenanttemplate.tmpl:13: unexpected \"{\" in operand" 
我浏览了Go模板的在线文档和关于堆栈溢出的一些其他答案,但没有任何帮助。

更改

 {{ if eq ({{envOrKey "IS_CUSTOMER"}}) "true" }}

 {{ if eq ({{envOrKey "IS_CUSTOMER"}}) "true" }}
 {{ if eq (envOrKey "IS_CUSTOMER") "true" }}