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
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

COPY "entrypoint.sh" "/entrypoint.sh"

ENTRYPOINT ["/entrypoint.sh"]
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ https://firebase.google.com/docs/hosting/github-integration

* `CONFIG_VALUES` - **Optional**. The configuration values for Firebase function that would normally be set with `firebase functions:config:set [value]`. Example: `CONFIG_VALUES: stripe.secret_key=SECRET_KEY zapier.secret_key=SECRET_KEY`.


### dotenv
It's optionally possible to inject the env from an arbitrary `.env`, [as per documentation](https://firebase.google.com/docs/functions/config-env). Useful in particular when the Github Action environment (including secrets) need to be passed on to the Firebase app.

ATTENTION: It requires a step to copy the needed env inside a `.env.*` or simply `.env` file in the root folder.

## Example

To authenticate with Firebase, and deploy to Firebase Hosting:
Expand Down