Hi,
I’m trying to work out how to configure settings differently between environments on the client side, as you would using .env files in Node.
Ideally, it would be a series of settings applied at the project level, per target environment, which allows us to set things like API parameters (domain, port, http/s, api version in the URL, etc), which we could then use in the various dynamic parameters parts of Wappler.
It also means when we migrate from dev to the higher environments, we don’t need to keep updating the URL every place it’s found.
You need to take into account that index.js will get overwritten with Wappler updates. So you need to redo with every update. Easy if you are using GIT.
Hello, I've started using dotenv. Thanks a lot for the detailed steps.
In addition, I have some recommendations on how to use it for db settings.
Just to recap the specific steps I followed:
Use the syntax: {{$_ENV.varName}} ej. {{$_ENV.pg_host}} directly in the UI or directly on code:
*it works with strings.
It would be handy for setting Server Connect Debug Mode = true/false, but apparently env variables can't return boolean values when called within a json file. (maybe I'm wrong)