Skip to content

feat: allow oveeridng nested runtime config with env#1831

Merged
pi0 merged 10 commits intonitrojs:mainfrom
becem-gharbi:fix/config-overwrite
Nov 30, 2023
Merged

feat: allow oveeridng nested runtime config with env#1831
pi0 merged 10 commits intonitrojs:mainfrom
becem-gharbi:fix/config-overwrite

Conversation

@becem-gharbi
Copy link
Copy Markdown
Contributor

@becem-gharbi becem-gharbi commented Oct 16, 2023

🔗 Linked issue

fix #1830

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Original behaviour
Runtime config properties with object type cannot be replaced by matching env variables.

    runtimeConfig: {
        feature: { // Setting NITRO_FEATURE=false do not work
            options: {  // Setting NITRO_FEATURE_OPTIONS=false do not work
                optionA: true,
                optionB: true
            }
        }
    }

Updated behaviour
Runtime config with object properties can be replaced by matching env variables.

    runtimeConfig: {
        feature: { // Setting NITRO_FEATURE=false works
            options: {  // Setting NITRO_FEATURE_OPTIONS=false works
                optionA: true,
                optionB: true
            }
        }
    }

📝 Checklist

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

@BobbieGoede
Copy link
Copy Markdown
Member

This would be pretty useful, is there anything blocking this from being merged?

@TheAlexLichter TheAlexLichter requested a review from pi0 November 25, 2023 11:10
@BobbieGoede
Copy link
Copy Markdown
Member

Rebase/merge with main should make the tests pass again, this PR will enable more Nuxt modules to add support for more complex runtime configuration (have a PR lined up for @nuxtjs/i18n built using this code).

Don't mean to rush anyone to merge this, but if I can be of any help to move it along let me know!

@pi0 pi0 changed the title fix: Enable config objects overwrite feat: allow oveeridng nested runtime config with env Nov 30, 2023
@pi0 pi0 requested a review from TheAlexLichter November 30, 2023 18:06
@pi0
Copy link
Copy Markdown
Member

pi0 commented Nov 30, 2023

Thanks for PR ❤️ and sorry for late review since i needed to properly verify changes.

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.

Runtime config objects not replaced by env variables

4 participants