How do you setup local environment variables for Cloud Functions for Firebase

后端 未结 5 1352
青春惊慌失措
青春惊慌失措 2020-12-04 17:30

I\'m using http cloud functions to listen for a request and then return a simple message.

I\'m developing cloud functions locally using:

firebase se         


        
5条回答
  •  伪装坚强ぢ
    2020-12-04 18:15

    I am not sure if the top-rated answer works or not but for firebase function on mac (to-serve locally), I do something like this

    npm run admin-keys && export dev=true && firebase emulators:start
    

    Where admin keys is

    "admin-keys": "export GOOGLE_APPLICATION_CREDENTIALS='./.keys/admin.keys.json'"
    

    This will load configuration from .runtimeconfig.json

    For production, you would manually have to set it by doing something like this

    firebase functions:config:set facebookCred.secret="something"
    

提交回复
热议问题