To alter the behavior of your application depending on environment some key pieces of information are needed:
- what type of environment is your app running in
- what is the specific name of environment
- what is the configuration/key/setting of this environment
To differentiate between Gitpod (Development) and Portainer/Deployed, you can use the environment variables acessible as such:
- TypeScript - process.env.igus
- ABL - OS-GETENV ( environment-variable )
If GITPOD_REPO_ROOT is set you are on Gitpod, if not present you are on Portainer or self-hosted environment.
You can set further environment variables via Gitpod or Portainer to have more specific information the environment, e.g.
APP_ENV= STAGE, for one Portainer stack that is used for staging, and as such read configuration that is specific for Staging APP_ENV= UAT, for User Acceptance Testing