Skip to content

WIP: feat: runtime config support for detectBrowserLanguage#2576

Closed
BobbieGoede wants to merge 7 commits intonuxt-modules:mainfrom
BobbieGoede:feature/runtime-config-detect-browser-language-2
Closed

WIP: feat: runtime config support for detectBrowserLanguage#2576
BobbieGoede wants to merge 7 commits intonuxt-modules:mainfrom
BobbieGoede:feature/runtime-config-detect-browser-language-2

Conversation

@BobbieGoede
Copy link
Copy Markdown
Member

@BobbieGoede BobbieGoede commented Nov 25, 2023

🔗 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

Primary motivation for adding runtime support is to actually to merge more test files 😂. Most if not all code for detectBrowserLanguage is used at runtime, so there is no need to rebuild the project to test each options.

nitrojs/nitro#1831 allows us to override runtime configs objects with environment variables, as this is currently not possible.

This PR changes the @nuxt/test-utils code further, startServer now optionally accepts additional environment variables. And I added helper functions to make setting runtime config variables via environment variables easier.

Using the following in a test

  await setRuntimeConfig({
    public: {
      i18n: {
        detectBrowserLanguage: false
      }
    }
  })

Will be converted into NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE=false and restarts the server with all properties in the passed object.

📝 Checklist

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

@BobbieGoede BobbieGoede marked this pull request as draft November 26, 2023 00:11
@BobbieGoede BobbieGoede changed the title feat: runtime config support for detectBrowserLanguage WIP: feat: runtime config support for detectBrowserLanguage Dec 1, 2023
@BobbieGoede BobbieGoede force-pushed the feature/runtime-config-detect-browser-language-2 branch 5 times, most recently from 4a90c66 to 1c428e4 Compare December 1, 2023 11:24
@BobbieGoede BobbieGoede force-pushed the feature/runtime-config-detect-browser-language-2 branch from 1c428e4 to d689ee0 Compare January 8, 2024 16:49
@BobbieGoede
Copy link
Copy Markdown
Member Author

Replaced by #2824

@BobbieGoede BobbieGoede closed this Mar 1, 2024
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.

1 participant