heroku config vars 可以是布尔值并且 ejs 可以访问它吗?
Can heroku config vars be boolean and can ejs access it?
我可以将 process.env.production
设置为 true
还是会转换为 "true"
?
即Heroku 中的配置变量必须始终是字符串,还是可以是布尔值?
此外:如果我的 index.ejs
中的 if/else
条件在 process.env.production
被设置为 true
时执行,是否会在渲染之前对其进行评估?
所有 heroku 配置变量都是环境变量,在 linux 环境中,只能是字符串。
所以您的所有变量在您的应用中都将是字符串一次。
不过,没有什么能阻止您执行以下操作:
var is_production = process.env.production === 'true'
我可以将 process.env.production
设置为 true
还是会转换为 "true"
?
即Heroku 中的配置变量必须始终是字符串,还是可以是布尔值?
此外:如果我的 index.ejs
中的 if/else
条件在 process.env.production
被设置为 true
时执行,是否会在渲染之前对其进行评估?
所有 heroku 配置变量都是环境变量,在 linux 环境中,只能是字符串。
所以您的所有变量在您的应用中都将是字符串一次。
不过,没有什么能阻止您执行以下操作:
var is_production = process.env.production === 'true'