You are here

function Provision_Service_http_https::config_data in Aegir HTTPS 7.3

File

drush/Provision/Service/http/https.php, line 47
The base implementation of the HTTPS capabale web service.

Class

Provision_Service_http_https
The base class for HTTPS supporting servers.

Code

function config_data($config = NULL, $class = NULL) {
  $data = parent::config_data($config, $class);
  $data['https_port'] = $this->server->https_port;
  if ($config == 'server') {
    if ($this->server
      ->service('Certificate')->can_generate_default) {

      // Generate a certificate for the default HTTPS vhost, and retrieve the
      // path to the cert and key files. It will be generated if not found.
      $certs = $this->server
        ->service('Certificate')
        ->get_certificates('default');
      $data = array_merge($data, $certs);
    }
  }
  if ($config == 'site' && $this->context->https_enabled) {
    if ($this->context->https_enabled == 2) {
      $data['ssl_redirection'] = TRUE;
      $data['redirect_url'] = "https://{$this->context->uri}";
    }
    if ($this->context->https_key) {

      // Retrieve the paths to the cert and key files.
      // They are generated if not found.
      $certs = $this->server
        ->service('Certificate')
        ->get_certificates($this->context->https_key);
      $data = array_merge($data, $certs);
    }
  }
  return $data;
}