Heroku process.env未显示配置变量 [英] Heroku process.env not showing config vars

查看:99
本文介绍了Heroku process.env未显示配置变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku管道中有一个React应用。只需分段->生产。

I have a react app in a Heroku pipeline. Simply staging -> production.

在分段=>设置中,我为环境设置了一些配置变量。但是,当我 console.log(process.env)时,我看不到它们。

In staging => Settings I have some config vars set up for the environment. However, when I console.log(process.env) I do not see them.

我应该能够以这种方式访问​​这些配置变量?通过阅读,我应该可以从 process.env 访问它们。不是吗?

Am I supposed to be able to access these config vars in this manner? From what I've read, I should be able to access them from process.env. No?

推荐答案

我正在使用以下buildpack: https://github.com/mars/ create-react-app-buildpack.git

I am using the following buildpack: https://github.com/mars/create-react-app-buildpack.git

显然,您必须将配置变量命名为 REACT_APP _ ,然后您可以通过 process.env 访问它们。

Apparently you MUST name the config vars starting with REACT_APP_ and then you can access them via process.env.

buildpack的文档。我实在太笨了,无法实际检查一下:/

This is all clearly outlined in the buildpack's documentation. I was just too dumb to actually check there :/

这篇关于Heroku process.env未显示配置变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆