You are here

protected function LockrRenewForm::getRenewedEnv in Lockr 4.x

Gets the env of the renewed cert.

Parameters

string $dir: The directory of the new certs.

Return value

string

1 call to LockrRenewForm::getRenewedEnv()
LockrRenewForm::submitForm in src/Form/LockrRenewForm.php
Form submission handler.

File

src/Form/LockrRenewForm.php, line 348

Class

LockrRenewForm
Form handler for Lockr renew cert.

Namespace

Drupal\lockr\Form

Code

protected function getRenewedEnv($dir) {
  $cert_path = "{$dir}/pair.pem";
  $client_config = $this->settings
    ->get('lockr_http_client_config');
  if (is_array($client_config)) {
    $opts = $client_config;
  }
  else {
    $opts = [];
  }
  $lockr_settings = new LockrSettings($cert_path, null, null, $opts);
  $client = LockrClient::createFromSettings($lockr_settings);
  $data = $client
    ->query([
    'query' => '{ self { env } }',
  ]);
  return $data['self']['env'] ?? 'unknown';
}