protected function loadCredentials() {
    if (empty($this->mail) || empty($this->key)) {
      if (empty($this->credentialsFile)) {
        $this->credentialsFile = new PhingFile($_SERVER['HOME'] . '/.acquia/cloudapi.conf');
      }

      if (!file_exists($this->credentialsFile) || !is_readable($this->credentialsFile)) {
        throw new BuildException("Acquia Cloud credentials file '{$this->credentialsFile}' is not available.");
      }

      $contents = file_get_contents($this->credentialsFile);
      $creds = json_decode($contents, TRUE);

      $this->mail = $creds['mail'];
      $this->key = $creds['key'];
    }

    if (empty($this->mail) || empty($this->key)) {
      throw new BuildException('Missing Acquia Cloud API credentials.');
    }
  }