Skip to content

build: set up generic way of passing in environment variables to dev app #21825

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

Merged
merged 1 commit into from
Feb 9, 2021

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Feb 6, 2021

Currently we have a one-off way of passing the Google Maps API key to the dev app. These changes rework the approach so that we have a single variables.json file which can be used for the Google Maps key, as well as any other variables in the future.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent merge safe target: patch This PR is targeted for the next patch release labels Feb 6, 2021
@crisbeto crisbeto requested review from devversion and a team as code owners February 6, 2021 12:52
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 6, 2021
@crisbeto
Copy link
Member Author

crisbeto commented Feb 6, 2021

@mbehrlich once these changes land, you'll have to change your google-maps-api-key.txt to variables.json with the following content:

{
  "GOOGLE_MAPS_KEY": "{{your key}}"
}

@crisbeto crisbeto force-pushed the dev-app-variables branch 3 times, most recently from a71ca33 to 9079446 Compare February 6, 2021 14:02
@@ -121,11 +121,11 @@ create_system_config(
output_name = "system-config.js",
)

Copy link
Member Author

Choose a reason for hiding this comment

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

@josephperrott I don't know how to resolve the lint errors in this file. I get a lint failure even after I run yarn format and the error doesn't actually say what's wrong. Here's the full log:

yarn run v1.22.10
Checking format of 1 file(s)

The following files are out of format:
    - src/dev-app/BUILD.bazel

? Format the files now? Yes
Formatting 1 file(s)
[========================================] ETA: 0s | 1/1 files
√  Formatting complete.
Done in 5.56s.

Copy link
Member

Choose a reason for hiding this comment

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

This issue was actually just reported a few days ago in another case. I need to address the error messaging that occurs to surface it.

For the specific situation, you can have a glob without a matcher.

You should instead have

filegroup(
    name = "variables",
    srcs = [
        "variables.json"
    ],
)

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is that the variables.json is an optional file that is .gitignored. Wouldn't using a filegroup like this result in an error if the file doesn't exist?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I ran into this problem too. You need the glob, because the file doesn't necessarily exist, but it needs some arbitrary matcher because of the lint issue, I assume due to the assumption that you would never need a glob for a single file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, adding a * in there fixed it 👍

Currently we have a one-off way of passing the Google Maps API key to the dev app.
These changes rework the approach so that we have a single `variables.json` file which
can be used for the Google Maps key, as well as any other variables in the future.
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Feb 8, 2021
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@annieyw annieyw added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Feb 9, 2021
@annieyw annieyw merged commit c7db803 into angular:master Feb 9, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants