Created
December 16, 2016 15:24
-
-
Save lornajane/fe9c5a73d514791d5c0f19fe7c6e867b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(isset($_ENV['VCAP_SERVICES'])) { | |
$vcap_services = json_decode($_ENV['VCAP_SERVICES'], true); | |
$rabbit_url = $vcap_services['compose-for-rabbitmq'][0]['credentials']['uri']; | |
$url_bits = parse_url($rabbit_url); | |
$config['rabbitmq']['host'] = $url_bits['host']; | |
$config['rabbitmq']['port'] = $url_bits['port']; | |
$config['rabbitmq']['vhost'] = substr($url_bits['path'], 1); | |
$config['rabbitmq']['username'] = $url_bits['user']; | |
$config['rabbitmq']['password'] = $url_bits['pass']; | |
$config['rabbitmq']['ssl'] = true; | |
$config['rabbitmq']['cert'] = base64_decode($vcap_services['compose-for-rabbitmq'][0]['credentials']['ca_certificate_base64']); | |
} else { | |
$config['rabbitmq']['host'] = "localhost"; | |
$config['rabbitmq']['port'] = 5672; | |
$config['rabbitmq']['username'] = "guest"; | |
$config['rabbitmq']['password'] = "guest"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment