From aaa963bcfed68c053ca4812188ec705923c303a6 Mon Sep 17 00:00:00 2001 From: lm <85850748+duvior@users.noreply.github.com> Date: Fri, 8 Jul 2022 06:44:51 -0500 Subject: [PATCH 1/3] Improved the environment variables example Made the nuxt.config.ts example using .env, a little more explicit. --- docs/content/2.guide/2.features/10.runtime-config.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/content/2.guide/2.features/10.runtime-config.md b/docs/content/2.guide/2.features/10.runtime-config.md index 527363b761b..fb951de4fef 100644 --- a/docs/content/2.guide/2.features/10.runtime-config.md +++ b/docs/content/2.guide/2.features/10.runtime-config.md @@ -54,9 +54,10 @@ NUXT_PUBLIC_API_BASE=https://nuxtjs.org ```ts [nuxt.config.ts] export default defineNuxtConfig({ runtimeConfig: { - apiSecret: '', + apiSecret: process.env.NUXT_API_SECRET, public: { - apiBase: '', // Or a default value + apiBase: process.env.NUXT_PUBLIC_API_BASE, + apiPublicKey: 'somePublicApiKey', // Or a default value } }, }) From 89321a50b254e848a6f8697ae7edd2d957d9ba3c Mon Sep 17 00:00:00 2001 From: lm <85850748+duvior@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:28:16 -0500 Subject: [PATCH 2/3] Update 10.runtime-config.md --- docs/content/2.guide/2.features/10.runtime-config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/2.guide/2.features/10.runtime-config.md b/docs/content/2.guide/2.features/10.runtime-config.md index fb951de4fef..1f766b52f6c 100644 --- a/docs/content/2.guide/2.features/10.runtime-config.md +++ b/docs/content/2.guide/2.features/10.runtime-config.md @@ -54,9 +54,9 @@ NUXT_PUBLIC_API_BASE=https://nuxtjs.org ```ts [nuxt.config.ts] export default defineNuxtConfig({ runtimeConfig: { - apiSecret: process.env.NUXT_API_SECRET, + apiSecret: process.env.NUXT_API_SECRET || '', // .env value + an empty string as a fallback value public: { - apiBase: process.env.NUXT_PUBLIC_API_BASE, + apiBase: process.env.NUXT_PUBLIC_API_BASE || 'someBase', // Or .env value + a fallback value apiPublicKey: 'somePublicApiKey', // Or a default value } }, From 7ad9f1fd64b821b6bf928a65397c229fa2428e9f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 13 Jul 2022 13:52:48 +0100 Subject: [PATCH 3/3] docs: updates --- docs/content/2.guide/2.features/10.runtime-config.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/content/2.guide/2.features/10.runtime-config.md b/docs/content/2.guide/2.features/10.runtime-config.md index 1f766b52f6c..0fdfc10e1c2 100644 --- a/docs/content/2.guide/2.features/10.runtime-config.md +++ b/docs/content/2.guide/2.features/10.runtime-config.md @@ -54,10 +54,9 @@ NUXT_PUBLIC_API_BASE=https://nuxtjs.org ```ts [nuxt.config.ts] export default defineNuxtConfig({ runtimeConfig: { - apiSecret: process.env.NUXT_API_SECRET || '', // .env value + an empty string as a fallback value + apiSecret: '', // can be overridden by NUXT_API_SECRET environment variable public: { - apiBase: process.env.NUXT_PUBLIC_API_BASE || 'someBase', // Or .env value + a fallback value - apiPublicKey: 'somePublicApiKey', // Or a default value + apiBase: '', // can be overridden by NUXT_PUBLIC_API_BASE environment variable } }, })