-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
[REQUIRED] Environment info
firebase-tools: 12.5.2
Platform: macOS
[REQUIRED] Test case
Change runtime optional in each environment by using dotenv file
[REQUIRED] Steps to reproduce
- Create two dotenv file, which are .env and .env.temp
- Set variables into .env and .env.temp, let keep track on variable PROJECT_ID
2.1 .env : PROJECT_ID=local
2.2 .env.temp : PROJECT_ID=temp - Run
firebase use temp
- Run
firebase deploy
[REQUIRED] Expected behavior
It must use PROJECT_ID in each environment; in this case must be PROJECT_ID=temp
[REQUIRED] Actual behavior
it use environment variable from .env file, .env.temp does not overwrite the default configuration
Example code
from firebase_functions import pubsub_fn, params
import os
REGION = os.environ.get("REGION")
PUBSUB_TOPIC_NAME = os.environ.get("PUBSUB_TOPIC_NAME")
PROJECT_ID = params.StringParam("PROJECT_ID")
@pubsub_fn.on_message_published(
topic=PUBSUB_TOPIC_NAME,
region=REGION,
service_account=f"test@{PROJECT_ID}.iam.gserviceaccount.com",
memory=16384,
timeout_sec=540,
cpu=8,
)
def Test(
event: pubsub_fn.CloudEvent[pubsub_fn.MessagePublishedData],
) -> None:
# Code