Skip to content

Commit 9efca9b

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

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

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

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -798,23 +798,18 @@ function ($metadata,
798798
// WECHATY_PUPPET_SERVICE_TLS_CA_CERT
799799
// WECHATY_PUPPET_SERVICE_TLS_SERVER_NAME
800800
$noTls = getenv("WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT");
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);
801+
if($noTls === "true" || $noTls === true) {
802+
Logger::DEBUG("start client with no tls");
803+
$this->_grpcClient = new \Wechaty\PuppetClient($hostname, [
804+
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
805+
'update_metadata' => $updateMetadata,
806+
]);
807+
} else {
808+
Logger::DEBUG("start client with tls");
809+
$this->_grpcClient = new \Wechaty\PuppetClient($hostname, [
810+
'credentials' => \Grpc\ChannelCredentials::createSsl(WechatyCA::TLS_CA_CERT),
811+
'update_metadata' => $updateMetadata,
812+
]);
818813
}
819814

820815
return $this->_grpcClient;

0 commit comments

Comments
 (0)