Pantheon\Terminus\Commands\HTTPS\SetCommand::set PHP Метод

set() публичный Метод

Add or replace an HTTPS certificate on an environment
public set ( string $site_env, string $certificate, string $private_key, $options = ['intermediate-certificate' => null] )
$site_env string Site and environment in the form `site-name.env`.
$certificate string A file containing the ssl certificate
$private_key string A file containing the private key
    public function set($site_env, $certificate, $private_key, $options = ['intermediate-certificate' => null])
    {
        list(, $env) = $this->getSiteEnv($site_env);
        $key = ['cert' => file_exists($certificate) ? trim(file_get_contents($certificate)) : $certificate, 'key' => file_exists($private_key) ? trim(file_get_contents($private_key)) : $private_key];
        if (!is_null($int = $options['intermediate-certificate'])) {
            if (file_exists($int)) {
                $key['intermediary'] = trim(file_get_contents($int));
            } else {
                $key['intermediary'] = $int;
            }
        }
        // Set the key for the environment.
        $workflow = $env->setHttpsCertificate($key);
        // Wait for the workflow to complete.
        $this->log()->notice('SSL certificate updated. Converging loadbalancer.');
        while (!$workflow->checkProgress()) {
            // @TODO: Add Symfony progress bar to indicate that something is happening.
        }
        $this->log()->notice($workflow->getMessage());
    }
SetCommand