'root', 'pass' => loadClass('Helper')->getEnv('MYSQL_ROOT_PASSWORD') )); break; case 'Pgsql': loadFile($class, $cnt_dir); $_LOADED_LIBS[$class] = \devilbox\Pgsql::getInstance($GLOBALS['PGSQL_HOST_NAME'], array( 'user' => loadClass('Helper')->getEnv('PGSQL_ROOT_USER'), 'pass' => loadClass('Helper')->getEnv('PGSQL_ROOT_PASSWORD'), 'db' => 'postgres' )); break; case 'Redis': // Check if redis is using a password $REDIS_ROOT_PASSWORD = ''; $_REDIS_ARGS = loadClass('Helper')->getEnv('REDIS_ARGS'); $_REDIS_PASS = preg_split("/--requirepass\s+/", $_REDIS_ARGS); if (is_array($_REDIS_PASS) && count($_REDIS_PASS)) { // In case the option is specified multiple times, use the last effective one. $_REDIS_PASS = $_REDIS_PASS[count($_REDIS_PASS)-1]; if (strlen($_REDIS_PASS) > 0) { $REDIS_ROOT_PASSWORD = $_REDIS_PASS; } } loadFile($class, $cnt_dir); if ($REDIS_ROOT_PASSWORD == '') { $_LOADED_LIBS[$class] = \devilbox\Redis::getInstance($GLOBALS['REDIS_HOST_NAME']); } else { $_LOADED_LIBS[$class] = \devilbox\Redis::getInstance($GLOBALS['REDIS_HOST_NAME'], array( 'pass' => $REDIS_ROOT_PASSWORD, )); } break; case 'Memcd': loadFile($class, $cnt_dir); $_LOADED_LIBS[$class] = \devilbox\Memcd::getInstance($GLOBALS['MEMCD_HOST_NAME']); break; case 'Mongo': loadFile($class, $cnt_dir); $_LOADED_LIBS[$class] = \devilbox\Mongo::getInstance($GLOBALS['MONGO_HOST_NAME']); break; // Get optional docker classes default: // Unknown class exit('Class does not exist: '.$class); } return $_LOADED_LIBS[$class]; } }