1
0
mirror of https://github.com/thingsboard/thingsboard-gateway synced 2025-10-26 22:31:42 +08:00

Added RATE_LIMITS env variable

This commit is contained in:
samson0v
2024-03-04 10:52:16 +02:00
parent cca1d39866
commit 3a5ff09303
2 changed files with 11 additions and 3 deletions

View File

@@ -132,9 +132,15 @@ class TBClient(threading.Thread):
if credentials.get("clientId") is not None:
self.__client_id = str(credentials["clientId"])
self.client = TBGatewayMqttClient(self.__host, self.__port, self.__username, self.__password, self,
quality_of_service=self.__default_quality_of_service,
client_id=self.__client_id)
if self.__config.get('rateLimits'):
self.client = TBGatewayMqttClient(self.__host, self.__port, self.__username, self.__password, self,
quality_of_service=self.__default_quality_of_service,
client_id=self.__client_id, rate_limit=self.__config['rateLimits'])
else:
self.client = TBGatewayMqttClient(self.__host, self.__port, self.__username, self.__password, self,
quality_of_service=self.__default_quality_of_service,
client_id=self.__client_id)
if self.__tls:
self.__ca_cert = self.__config_folder_path + credentials.get("caCert") if credentials.get(
"caCert") is not None else None

View File

@@ -132,6 +132,8 @@ def get_env_variables():
env_variables['username'] = environ.get('TB_GW_USERNAME')
if environ.get('TB_GW_PASSWORD'):
env_variables['password'] = environ.get('TB_GW_PASSWORD')
if environ.get('TB_GW_RATE_LIMITS'):
env_variables['rateLimits'] = environ.get('TB_GW_RATE_LIMITS')
converted_env_variables = {}