From d55159582cf5e8f2a5a7d7a878d08981abbbee85 Mon Sep 17 00:00:00 2001 From: David Stack <2013388+davidstackio@users.noreply.github.com> Date: Tue, 6 Aug 2024 08:46:56 -0400 Subject: [PATCH 1/2] docs: add Nuxt note about public environment variables --- docs/nuxt/environment-variables.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/nuxt/environment-variables.md b/docs/nuxt/environment-variables.md index 199dbfb5..fc54ed1e 100644 --- a/docs/nuxt/environment-variables.md +++ b/docs/nuxt/environment-variables.md @@ -2,6 +2,8 @@ Nuxt VueFire automatically picks up a few environment variables to configure Firebase from your `.env` file. These usually take precedence over other options defined in `nuxt.config.ts`. They usually try to support the existing Firebase environment variables better. +The VueFire config is treated as public Nuxt config, which means that any env variable [defined using the Nuxt convention](https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables) will automatically be picked up by Nuxt. This means you can add, for example, `NUXT_PUBLIC_VUEFIRE_CONFIG_API_KEY=xyz` to your `.env` file and the value will populate in your app at runtime. You will still need to provide empty string values to the vuefire config to prevent an error during development. + ## Admin SDK During development, if you are doing SSR, you must provide the `GOOGLE_APPLICATION_CREDENTIALS` environment variable with the path to the service account file. This is usually a JSON file you can download from the Firebase Console > Project Settings > Service Accounts > Generate new private key. From 20a89827654f0a981b22cff3d8e0c24548a90169 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 6 Aug 2024 15:31:11 +0200 Subject: [PATCH 2/2] Update docs/nuxt/environment-variables.md --- docs/nuxt/environment-variables.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/nuxt/environment-variables.md b/docs/nuxt/environment-variables.md index fc54ed1e..44166fc6 100644 --- a/docs/nuxt/environment-variables.md +++ b/docs/nuxt/environment-variables.md @@ -2,7 +2,8 @@ Nuxt VueFire automatically picks up a few environment variables to configure Firebase from your `.env` file. These usually take precedence over other options defined in `nuxt.config.ts`. They usually try to support the existing Firebase environment variables better. -The VueFire config is treated as public Nuxt config, which means that any env variable [defined using the Nuxt convention](https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables) will automatically be picked up by Nuxt. This means you can add, for example, `NUXT_PUBLIC_VUEFIRE_CONFIG_API_KEY=xyz` to your `.env` file and the value will populate in your app at runtime. You will still need to provide empty string values to the vuefire config to prevent an error during development. +Since VueFire config is treated as _Public Runtime Config_, it can also be overridden with [env variables by following the Nuxt convention](https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables). For example, an environment variable named `NUXT_PUBLIC_VUEFIRE_CONFIG_API_KEY=xyz` will override the `config.apiKey`. +Note you still need to provide empty string values to each `config` property that is defined this way. ## Admin SDK