Target wise Server Actions Globals?

Please test with the following update.

DMXzone.ServerConnect.zip (51.5 KB)

1 Like

thanks - will check and keep you posted.
the env variables set in web.config will be read by Wappler - correct?

Thanks for the update Patrick.
We are now able to read Environment Variable set on OS level - i.e. in the system variables section in Windows.
We had to restart the system after adding new values.

But, like in NodeJS, can the environment variables be set somewhere on the project level and not on the OS level?
We were hoping the changes you have done would allow us to pickup something like appSettings (or any other heading) from web.config file that resides inside the project.

We use https://docs.microsoft.com/en-us/dotnet/api/system.environment.getenvironmentvariables?view=net-5.0 to retrieve the environment variables. I was hoping that it would also pickup the variables that where set in the web.config (https://docs.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/environmentvariables/). Setting variables using the web.config is only possible with IIS 10 and you set it per application pool. Will do some more research on how to use it.

Thanks a lot. :pray:
We tried that too, but its values are not accessible easily even on a C# project.

With the current environment setup that you have done, its quite great actually. We can also use these env variable on the client side using <% %> ASP scripting tags… similar to what we can do in NodeJS.

The reason why I ask for web.config is because we have a situation where our dev server machine has two copies of the same Wappler code base. Both websites are slight variations controlled by their own DB (Wappler target based DB helps here).
So in this case, I cannot use the system level env variables as both projects would read the same OS level values.
With web.config, I would be able to keep the project specific variables separate on the same server, and also access those on the client side too.

The application pool env variables are not really accessible on the client side using the script tags. So that is not a good solution in my opinion. What you have right now is much better in comparison.

Unfortunately, that does not solve our requirement, hence the request to use web.config instead.
I would really appreciate if you could either find some way to use app pool env variables & allow access on client side too (somehow!)… else find a solution to use project web.config for env variables instead of OS.

If both don’t work out, what you have right now is a great solution too. :slightly_smiling_face: