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
Extensions build command is HARDCODING the NODE_ENV environment variable to: production #17556
Comments
Linear: ENG-710 |
I can well imagine that the reason for the hard-coded value is that it provides a bit of extra security and it can be assumed that extensions will eventually almost always run in a productive node environment and thus be tested in this context right away. (Maybe @rijkvanzanten / @nickrum can confirm or correct this) |
What happens if you build your extension in its un-minified form ? |
This was mainly done for App extensions because some libraries expect bundlers to replace |
I see! Thanks! So just to be sure, you're suggesting to remove it only for API extensions but keep it for App extensions? |
@paescuj Lets try to remove it from both if we can 👍🏻 Hopefully there's another way for the end-user to add it themselves on the app extensions side if it's required :) (Bit hard to explain why it exists, and only for some extension types in that other case) |
Exactly 👍
There is not because |
Copy that! Ty :) |
Checklist
Describe the Bug
We build an extensions that get ENVs variable to DB connection based on the
NODE_ENV
variable so for example:In test env we use SQLite, in local we use Mysql and in production another Mysql
The problem we are facing, is that when we are working either in test or locally we keep having the NODE_ENV variable with value
production
we found this PR that introduced this change: https://github.com/directus/directus/pull/7627/filesWe where not sure why we were always getting
production
value for theNODE_ENV
variable and the PR above is the why.The solution could be to not Hardcode the value instead taking it from the ENV where it is being used
To Reproduce
Just create a hook and do a
console.log('NODE_ENV', process.env.NODE_ENV)
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: