diff --git a/index.d.ts b/index.d.ts index 4e610b25..095f989c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -29,6 +29,8 @@ export interface ClientConfig { tlsTrustCertsFilePath?: string; tlsValidateHostname?: boolean; tlsAllowInsecureConnection?: boolean; + tlsCertificateFilePath?: string; + tlsPrivateKeyFilePath?: string; statsIntervalInSeconds?: number; log?: (level: LogLevel, file: string, line: number, message: string) => void; } diff --git a/src/Client.cc b/src/Client.cc index f557a089..1bcb2b95 100644 --- a/src/Client.cc +++ b/src/Client.cc @@ -38,6 +38,8 @@ static const std::string CFG_USE_TLS = "useTls"; static const std::string CFG_TLS_TRUST_CERT = "tlsTrustCertsFilePath"; static const std::string CFG_TLS_VALIDATE_HOSTNAME = "tlsValidateHostname"; static const std::string CFG_TLS_ALLOW_INSECURE = "tlsAllowInsecureConnection"; +static const std::string CFG_TLS_CERTIFICATE_FILE_PATH = "tlsCertificateFilePath"; +static const std::string CFG_TLS_PRIVATE_KEY_FILE_PATH = "tlsPrivateKeyFilePath"; static const std::string CFG_STATS_INTERVAL = "statsIntervalInSeconds"; static const std::string CFG_LOG = "log"; @@ -181,6 +183,12 @@ Client::Client(const Napi::CallbackInfo &info) : Napi::ObjectWrap(info) tlsAllowInsecureConnection.Value()); } + if (clientConfig.Has(CFG_TLS_ALLOW_INSECURE) && clientConfig.Get(CFG_TLS_ALLOW_INSECURE).IsBoolean()) { + Napi::Boolean tlsAllowInsecureConnection = clientConfig.Get(CFG_TLS_ALLOW_INSECURE).ToBoolean(); + pulsar_client_configuration_set_tls_allow_insecure_connection(cClientConfig.get(), + tlsAllowInsecureConnection.Value()); + } + if (clientConfig.Has(CFG_STATS_INTERVAL) && clientConfig.Get(CFG_STATS_INTERVAL).IsNumber()) { uint32_t statsIntervalInSeconds = clientConfig.Get(CFG_STATS_INTERVAL).ToNumber().Uint32Value(); pulsar_client_configuration_set_stats_interval_in_seconds(cClientConfig.get(), statsIntervalInSeconds);