feat: add .env support#167
Open
sirnicolaz wants to merge 3 commits into
Open
Conversation
Owner
|
This doesn't work, you can't copy something that doesn't exist if the user doesn't specify it (as optional) |
Author
|
you are right. for some reason, when I ran it locally with the glob, it wasn't throwing an error in case of a missing file. I will check what's going on and update the pr. apologies for the inconvenience |
densk1
reviewed
Jan 19, 2023
| RUN npm i -g firebase-tools@11.16.0 | ||
|
|
||
| COPY LICENSE README.md / | ||
| COPY .env* / |
There was a problem hiding this comment.
I've an issue with functions .env files not being imported at build time. I'm trying to set region from .env which works for CLI deploy but not in a Github Workflow. So this would be helpful alright.
Worth noting that docs seem to indicate (in a roundabout way) that .env.* for functions should live in the /functions directory.
https://firebase.google.com/docs/functions/config-env#params
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Firebase supports the injection of the
.envconfiguration, as documented here.This turns out to be particularly useful in the context of Github Actions when for instance one would like to store all secrets in Github and pass them on to the firebase deploy script, or simply if willing to re-use the env from the Github Action inside the app.
In such a case, it's just enough to copy the env inside a
.envfile and the firebase deploy script will pick it up and make it visible inside the app.This PR adds support for such behaviour.