Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment Variables don't load if there is a number in the name #14432

Closed
akeemphilbert opened this issue Jul 27, 2022 · 4 comments
Closed

Comments

@akeemphilbert
Copy link

Environment


  • Operating System: Darwin
  • Node Version: v16.15.0
  • Nuxt Version: 3.0.0-rc.5
  • Package Manager: yarn@1.22.15
  • Builder: vite
  • User Config: ssr, css, build, vite, runtimeConfig
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/akeemphilbert/nuxt-issue-reproduction

Describe the bug

If a public runtime configuration name has a number in it (e.g. api1Base) then the corresponding environment variable does not load (NUXT_PUBLIC_API1_BASE)

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

danielroe commented Jul 27, 2022

The key is split like this: NUXT_PUBLIC_API_1BASE. We use https://github.com/unjs/scule's snake case helper to split it. I think we could likely update the implementation to NUXT_PUBLIC_API1_BASE or even NUXT_PUBLIC_API_1_BASE

@danielroe
Copy link
Member

danielroe commented Jul 27, 2022

Actually this has already been fixed upstream (to NUXT_PUBLIC_API_1_BASE ) but never released.

cc: @pi0 - we don't seem to have 0.3.0 on npm despite unjs/scule@91fd6ab

pi0 referenced this issue in nitrojs/nitro Jul 27, 2022
@pi0
Copy link
Member

pi0 commented Jul 27, 2022

Thanks for reporting @akeemphilbert and investigation @danielroe ❤️

scule 3 is released with fix and also updated nitro which was using it.

With the current (buggy) version, you can override with NITRO_PUBLIC_API_1BASE.

I will updated this issue accordingly with final fixed behavior and naming.

@pi0 pi0 self-assigned this Jul 27, 2022
@danielroe
Copy link
Member

Latest behaviour is that we ignore numbers for case changing. So you would override public.api1Base with NUXT_PUBLIC_API1_BASE as you originally expected.

@pi0 shall we close this issue now, or are you planning on making further changes?

WinterYukky referenced this issue in WinterYukky/nitro Nov 1, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants