Skip to content

Improve automation for env vars for Data Connect init. #8684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

yuchenshi
Copy link
Member

@yuchenshi yuchenshi commented May 30, 2025

Description

See CHANGELOG.md

Scenarios Tested

Screenshot_1748644971

Sample Commands

firebase init

firebase init dataconnect

Created using spr 1.3.6-beta.1
projectMetaData = await projectChoicePrompt(options);
if (!projectMetaData) {
return;
const projectEnvVar = utils.envOverride("GCLOUD_PROJECT", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defer to @joehan on this~

Is this a reasonable env name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it probably should be GOOGLE_CLOUD_PROJECT or FIREBASE_PROJECT

GoogleCloudPlatform/nodejs-getting-started#251 GCLOUD_PROJECT is a deprecated CF3 env var - obviously not gonna affect this, but I'd prefer to keep consistency accross products when possible

We also have some code in place that populates GCLOUD_PROJECT to support very old firebase-functions versions, so it'll be nice to avoid any interactions with that by using GOOGLE_CLOUD_PROJECT instead

Copy link
Member Author

@yuchenshi yuchenshi Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I've changed it to FIREBASE_PROJECT. Later maybe we can make it a drop-in replacement of --project. Or not. The script can work either way

if (cwdPlatformGuess !== Platform.NONE) {
// If a platform can be detected or a connector is chosen via env var, always
// setup SDK. FDC_CONNECTOR is used for scripts under https://firebase.tools/.
if (cwdPlatformGuess !== Platform.NONE || envOverride("FDC_CONNECTOR", "")) {
await sdk.doSetup(setup, config);
} else {
logBullet(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we can change this to a confirmation~

We can do it separately

Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but probably switch the env var

projectMetaData = await projectChoicePrompt(options);
if (!projectMetaData) {
return;
const projectEnvVar = utils.envOverride("GCLOUD_PROJECT", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it probably should be GOOGLE_CLOUD_PROJECT or FIREBASE_PROJECT

GoogleCloudPlatform/nodejs-getting-started#251 GCLOUD_PROJECT is a deprecated CF3 env var - obviously not gonna affect this, but I'd prefer to keep consistency accross products when possible

We also have some code in place that populates GCLOUD_PROJECT to support very old firebase-functions versions, so it'll be nice to avoid any interactions with that by using GOOGLE_CLOUD_PROJECT instead

yuchenshi added 2 commits June 3, 2025 11:41
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@yuchenshi yuchenshi enabled auto-merge (squash) June 3, 2025 20:07
@yuchenshi yuchenshi merged commit 3416f84 into master Jun 3, 2025
48 of 50 checks passed
@yuchenshi yuchenshi deleted the spr/yuchenshi/improve-automation-for-env-vars-for-data-connect-init branch June 3, 2025 20:15
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants