Files
firebase-tools/scripts/assets/functions_to_test_minimal.js
Daniel Lee d9aaaec1f3 Deploy environment variables in dotenv files for functions (#3645)
Add support for setting up environment variables for functions using dotenv files.

On deploy, Firebase CLI looks for naive dotenv file (`.env`) file or project-specific ones (`.env.<project id>` or `.env.<project alias>`) files, loads environment variables, and injects them on deployed functions. Environment variable set in project-specific dotenv file wins, and you cannot have both `.<project id>` and `<.project alias>` files.

Environment variables are also loaded up on Firebase Emulators. Emulator will look for `.env` and `.env.local` files and ignore project-specific dotenv files.

We are hiding the feature behind `dotenv` preview flag. We want to get a feeling for the development experience from our users before an official launch + documentations.

Also including a small e2e test for env var support. It's meant to run manually by the Firebase team via command `node scripts/test-functions-env.js`.
2021-08-11 13:31:18 -07:00

6 lines
144 B
JavaScript

var functions = require("firebase-functions");
exports.httpsAction = functions.https.onRequest(function (req, res) {
res.send(req.body);
});