How to set JSON object as heroku environment variable on Git Bash

谁说胖子不能爱 提交于 2019-12-11 17:18:34

问题


When working with a Google API's "credentials.json" file, we sometimes need to store the entire contents in an environment variable. The following approach works on Mac OS and in Git Bash on Windows:

export LOCAL_CREDS="$(< auth/credentials.json)"

When we need to set this same environment variable on a heroku server, the following approach works on a Mac:

heroku config:set REMOTE_CREDS="$(< auth/credentials.json)" 

... but on Git Bash on Windows it produces the following error:

heroku config:set REMOTE_CREDS="$(< auth/credentials.json)"
#> 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

I tried specifying the absolute filepath instead of a relative one, passing a JSON string directly (see below), but none of these approaches work.

heroku config:set FOO_JSON='{"abc":"bcd","cde":"def"}'
#> 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

How can we set these JSON-like environment variables on a heroku server via Git Bash on Windows?

FYI:

heroku --version
#> heroku/7.26.2 win32-x64 node-v11.14.0

which heroku
#> /c/Program Files/heroku/bin/heroku

来源:https://stackoverflow.com/questions/56859583/how-to-set-json-object-as-heroku-environment-variable-on-git-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!