Wappler Version : 6.7.3
Operating System : MacOS Sonoma 14.5
Server Model: Nodejs, Docker
Database Type: MySQL
Hosting Type: local and remote
Expected behavior
I set environment variables according to Using Global Environment Variables I was then expecting to be able to set target-specific values as in the How To. I was successful for Development & Production, but Staging Environment variables were not showing. Here's my Development Environment successfully configured:
After noticing Staging environment variables were not showing, I restarted Wappler. I went back to my Staging target, selected Globals in Server Actions and saw this...not good:
Not only are the global environment variables still not showing, but it appears my g_identity step is also broken! In production, I still see the Environment variables in Server Connect Settings, but g_identity appears the same way in the global.json file as it does in Development and Staging.
How to reproduce
Have 3 environments, 1 local and 2 remote, name them Development, Staging, and Production.
Have g_identity Security Provider step already defined in global.json.
Follow Teodor's How To for development and Production as in his How To.
Open Staging to configure in the same way. It was not possible on my Wappler.
Restart Wappler and open any of the global.json files for any target.
Furthermore, looking at the folder structure in .wappler, Development & Staging are similar under app/modules but Production is missing the Mailer folder and mailer.json file
There is a very long standing bug report relating to the staging the environment which is not marked as fixed; i have no idea if it is or not.
Perhaps it is related and staging in overwriting the production settings?
I did some more troubleshooting. I've determined that for the Staging target, if I renamed the mailer.json file (it did NOT have the appropriate ENV vars set), then Staging will use the main mailer.json file's settings found in MyProject/app/modules/mailer folder. This is good and a step in the right direction.
Now at least, my staging env has the appropriate mailer.json configurations. I do not yet know if it will work correctly and use the correct server/port/username/password combination however.
I was able to easily fix the g_identity issue by just adding it back into the global.json file and deleting the broken element.
I think I've been able to correct this issue. This is STILL A BUG however. Here are the steps I took to restore the lost configurations:
Since all of my global environment variables were lost, I had to recreate them. I was able to use the Wappler UI to create new global environment variables just as in the original How To. They will show up in the file MyProject/app/modules/global.json
I also had to edit my global.json file within the UI to delete the broken execute step and add it back from the Security Providers group.
Next was to get Staging to have its mailer configuration set correctly. It could now see the global ENV variables and a copy/paste of the values from the Development target's config.json file made quick work of this.
I strongly suggest the Wappler team mark the How To use Global Environment Variables as dangerous at this time.
Now I must spend the next hour going through QA testing in Staging. I have other enhancements I want to push to prod but very cautious right now.