Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

docs: improve runtimeConfig example - #5785

Merged
pi0 merged 3 commits into
nuxt:mainfrom
duvior:patch-1
Jul 13, 2022
Merged

docs: improve runtimeConfig example#5785
pi0 merged 3 commits into
nuxt:mainfrom
duvior:patch-1

Conversation

@duvior

@duviorduvior commented Jul 8, 2022

Copy link
Copy Markdown
Contributor

Made the nuxt.config.ts example using .env, a little more explicit.

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Made the nuxt.config.ts example using .env, a little more explicit.
@netlify

netlifyBot commented Jul 8, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs ready!

NameLink
🔨 Latest commit7ad9f1f
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62cec0233883a10008749eb0
😎 Deploy Previewhttps://deploy-preview-5785--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@atinux
atinux requested a review from danielroeJuly 11, 2022 11:37

@danielroedanielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This won't work as written. The point being made above is:

For this to work, you must have a fallback value (which can just be an empty string) defined in your nuxt.config.

We're trying to avoid the situation where someone thinks that just because they have apiSecret: process.env.NUXT_API_SECRET defined in the config, that this will therefore means it gets overriden in production. (It won't work unless NUXT_API_SECRET is defined at build-time.

Instead, it must be at least: apiSecret: process.env.NUXT_API_SECRET || ''.

We also want to make it clear that the name of the environment variable is determined by the key within runtimeConfig - e.g. apiSecret becaomes NUXT_API_SECRET rather than by the environment variable passed as the default variable.

Any thoughts about how to make the above clearer in the example would be welcome.

@danielroedanielroe changed the title Improved the environment variables exampledocs: improve runtimeConfig exampleJul 11, 2022
@danielroedanielroe added the documentation Improvements or additions to documentation label Jul 11, 2022
@pi0

pi0 commented Jul 11, 2022

Copy link
Copy Markdown
Member

Any thoughts about how to make the above clearer in the example would be welcome.

We might use comments in the docs after the value: (example)

var: ''// Can be overridden by NUXT_APP_VAR environment variable

@danielroedanielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's go with @pi0's suggestion, which I think is clearer.

Comment threaddocs/content/2.guide/2.features/10.runtime-config.md Outdated
Comment threaddocs/content/2.guide/2.features/10.runtime-config.md Outdated
@pi0
pi0 merged commit a745be3 into nuxt:mainJul 13, 2022
@pi0pi0 mentioned this pull request Jul 15, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xdocumentationImprovements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@duvior@pi0@danielroe