简体   繁体   中英

Using environment Variables in Javascript file when deploying it on Heroku

I have an app written in JS,HTML and CSS which uses an API KEY. I have used environment variables locally to use API KEY. I have deployed it to heroku and while pushing to gitlab, I have added .env to gitignore and now after deployment, map is not visible because it can not access API KEY for maps. I want to ask how to use environment variables in production (in Heroku deployment)?

You can either use their online dashboard or the CLI to add env vars.

See their docs here: https://devcenter.heroku.com/articles/config-vars#managing-config-vars

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM