@@ 459-481 (lines=23) @@ | ||
456 | * @param string $env The environment to return the proxy_host for. Must be one of the RealMe environment names |
|
457 | * @return string|null Returns the SOAPClient `proxy_host` param, or null if there isn't one |
|
458 | */ |
|
459 | public function getProxyHostForEnvironment($env) |
|
460 | { |
|
461 | $host = $this->getConfigurationVarByEnv('backchannel_proxy_hosts', $env); |
|
462 | ||
463 | // Allow usage of an environment variable to define this |
|
464 | if (substr($host, 0, 4) === 'env:') { |
|
465 | $host = getenv(substr($host, 4)); |
|
466 | ||
467 | if ($host === false) { |
|
468 | // getenv() didn't return a valid environment var, it's either mis-spelled or doesn't exist |
|
469 | $host = null; |
|
470 | } else { |
|
471 | $host = parse_url($host, PHP_URL_HOST); |
|
472 | ||
473 | // This may happen on seriously malformed URLs, in which case we should return null |
|
474 | if ($host === false) { |
|
475 | $host = null; |
|
476 | } |
|
477 | } |
|
478 | } |
|
479 | ||
480 | return $host; |
|
481 | } |
|
482 | ||
483 | /** |
|
484 | * Gets the proxy port (if required) for back-channel SOAP requests. The proxy port can begin with the string 'env:' |
|
@@ 492-514 (lines=23) @@ | ||
489 | * @param string $env The environment to return the proxy_port for. Must be one of the RealMe environment names |
|
490 | * @return string|null Returns the SOAPClient `proxy_port` param, or null if there isn't one |
|
491 | */ |
|
492 | public function getProxyPortForEnvironment($env) |
|
493 | { |
|
494 | $port = $this->getConfigurationVarByEnv('backchannel_proxy_ports', $env); |
|
495 | ||
496 | // Allow usage of an environment variable to define this |
|
497 | if (substr($port, 0, 4) === 'env:') { |
|
498 | $port = getenv(substr($port, 4)); |
|
499 | ||
500 | if($port === false) { |
|
501 | // getenv() didn't return a valid environment var, it's either mis-spelled or doesn't exist |
|
502 | $port = null; |
|
503 | } else { |
|
504 | $port = parse_url($port, PHP_URL_PORT); |
|
505 | ||
506 | // This may happen on seriously malformed URLs, in which case we should return null |
|
507 | if ($port === false) { |
|
508 | $port = null; |
|
509 | } |
|
510 | } |
|
511 | } |
|
512 | ||
513 | return $port; |
|
514 | } |
|
515 | ||
516 | /** |
|
517 | * @param string $cfgName The static configuration value to get. This should be an array |