Page 1 of 1

Configuring different environments

Posted: Mon Dec 14, 2020 6:04 am
by pawansaxena
Hello all,

I am running processmaker 3.4, i can see that there is a env.ini file residing in the workflow/engine/config directory but that have some environment values as APP_ENV and it is set to production.
Also there's a environments.php file in the same directory but with different variables, i am not sure whether that file plays a role anymore or it is just sitting there.

Whenever i see the logs ( even on dev i see the production text in the logs and not dev, as i have not setup the dev env)
Can anyone help me as where and how can i use different env.ini files for different environment and tell processmaker to use respective environment values.

Re: Configuring different environments

Posted: Mon Dec 21, 2020 2:28 pm
by programerboy
Hi,
You can check this link for get available settings:
https://wiki.processmaker.com/3.5/Configuration_File_env.ini

http://pmlearning.info
Thanks

Re: Configuring different environments

Posted: Sun Jan 17, 2021 9:56 pm
by pawansaxena
This is a good wiki link. But whenever i want to set some environment variable, i didn't want to go and change the .env.ini file directly. I wanted to extend this functionality to have some .env in project root.

I am able to do so by changing some code in System.php inside /workflow/engine/src/Processmaker/Core/System.php

Inside getSystemConfiguration method add below lines :
Code: Select all
if (!empty($globalIniFile)) {
            $appEnvFile = app()->environmentFile();
            $appEnvFilePath = PATH_TRUNK . $appEnvFile;
            if (file_exists($appEnvFilePath)) {
                if (($appEnvConfig = @parse_ini_file($appEnvFilePath)) !== false) {
                    $config = array_merge($config, $appEnvConfig);
                }
            }
        }

        if (!empty($wsIniFile)) {
            $appEnvFile = app()->environmentFile();
            $appEnvFilePath = PATH_DB . $wsName . PATH_SEP . $appEnvFile;
            if (file_exists($appEnvFilePath)) {
                if (($appEnvConfig = @parse_ini_file($appEnvFilePath)) !== false) {
                    $config = array_merge($config, $appEnvConfig);
                }
            }
        }
Hope it helps someone.

Cheers !!!