firebase functions to store and securely return third party API keys for mobile
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Add firebase project on console.firebase.google.com Install firebase on your machine. Refer Firebase functions - get started
- git clone the project
- Open project directory, run
firebase login
- Run
firebase init project
firebase will ask you to whether to overwrite package.json and index.js
Select NO for both the options
? File functions/package.json already exists. Overwrite? No
i Skipping write of functions/package.json
? File functions/index.js already exists. Overwrite? No
i Skipping write of functions/index.js
? Do you want to install dependencies with npm now? Yes
- Set API key as firebase environment variable
firebase functions:config:set api.key=API_KEY api.id=SERVICE_NAME
- If you are going test locally, set up runtime environemnts
firebase functions:config:get > .runtimeconfig.json
cd functions/
npm install
firebase serve --only functions
firebase deploy --only functions