Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 03c925e

Browse files
add wechaty ca, see #16
1 parent e55a52c commit 03c925e

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

‎wechaty-puppet-service/IO/Github/Wechaty/PuppetService/PuppetService.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use IO\Github\Wechaty\PuppetService\Exceptions\PuppetServiceException;
2727
use IO\Github\Wechaty\Util\Console;
2828
use IO\Github\Wechaty\Util\Logger;
29+
use LM\Exception;
2930
use Wechaty\Puppet\ContactPayloadResponse;
3031
use Wechaty\Puppet\EventResponse;
3132
use Wechaty\Puppet\EventType;
@@ -797,18 +798,23 @@ function ($metadata,
797798
// WECHATY_PUPPET_SERVICE_TLS_CA_CERT
798799
// WECHATY_PUPPET_SERVICE_TLS_SERVER_NAME
799800
$noTls = getenv("WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT");
800-
if($noTls === "true" || $noTls === true) {
801-
Logger::DEBUG("start client with no tls");
802-
$this->_grpcClient = new \Wechaty\PuppetClient($hostname, [
803-
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
804-
'update_metadata' => $updateMetadata,
805-
]);
806-
} else {
807-
Logger::DEBUG("start client with tls");
808-
$this->_grpcClient = new \Wechaty\PuppetClient($hostname, [
809-
'credentials' => \Grpc\ChannelCredentials::createSsl(WechatyCA::TLS_CA_CERT),
810-
'update_metadata' => $updateMetadata,
811-
]);
801+
try {
802+
if($noTls === "true" || $noTls === true) {
803+
Logger::DEBUG("start client with no tls");
804+
$this->_grpcClient = new \Wechaty\PuppetClient($hostname, [
805+
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
806+
'update_metadata' => $updateMetadata,
807+
]);
808+
} else {
809+
Logger::DEBUG("start client with tls");
810+
$this->_grpcClient = new \Wechaty\PuppetClient($hostname, [
811+
'credentials' => \Grpc\ChannelCredentials::createSsl(WechatyCA::TLS_CA_CERT),
812+
'update_metadata' => $updateMetadata,
813+
]);
814+
}
815+
} catch (\Exception $e) {
816+
Logger::ERR("start client error");
817+
Logger::ERR($e);
812818
}
813819

814820
return $this->_grpcClient;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /