Skip to content
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

feat: add .env support #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

feat: add .env support #167

wants to merge 3 commits into from

Conversation

sirnicolaz
Copy link

Firebase supports the injection of the .env configuration, 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 .env file and the firebase deploy script will pick it up and make it visible inside the app.

This PR adds support for such behaviour.

@w9jds
Copy link
Owner

w9jds commented Dec 5, 2022

This doesn't work, you can't copy something that doesn't exist if the user doesn't specify it (as optional)

@sirnicolaz
Copy link
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

Dockerfile Outdated
@@ -16,6 +16,7 @@ RUN npm i -g [email protected]
RUN npm i -g [email protected]

COPY LICENSE README.md /
COPY .env* /
Copy link

Choose a reason for hiding this comment

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

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

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