How to reference Firebase Functions config variables from a Firebase-hosted application?

前端 未结 2 997
执笔经年
执笔经年 2021-01-25 03:06

I am transitioning a Heroku-hosted ReactJS/NodeJS application to be hosted on Firebase. Because Firebase only handles static pages I need to reconfigure how my private environme

相关标签:
2条回答
  • 2021-01-25 03:36

    The variables you define through the link you provided are only available via Cloud Functions. They're not made available directly to the static content served by Firebase Hosting.

    If you want, you can make an HTTP function that does nothing but return the JSON from your env vars, and call that from your web content. Bear in mind that you're exposing your secret keys to the world.

    0 讨论(0)
  • 2021-01-25 03:54

    The best practice way to handle what I am trying to do is to refactor all of the application logic requiring environment configuration into firebase functions. I can then invoke said functions to reference environment config and execute the code consuming them. This is the answer/solution I needed and didn't have the context to realize earlier. thanks for edging me towards that realization.

    0 讨论(0)
提交回复
热议问题