mirror of
https://github.com/thingsboard/thingsboard-gateway
synced 2025-10-26 22:31:42 +08:00
Removed useless parameters in configuration file
This commit is contained in:
parent
041513efb1
commit
41b31667c9
|
|
@ -124,9 +124,12 @@ class TBClient(threading.Thread):
|
|||
|
||||
def _create_mqtt_client(self, credentials):
|
||||
self.__tls = bool(credentials.get('tls', False) or credentials.get('caCert', False))
|
||||
if credentials.get("accessToken") is not None:
|
||||
credentials_type = credentials.get('type')
|
||||
if credentials_type is None and credentials.get('accessToken') is not None:
|
||||
credentials_type = 'accessToken'
|
||||
if credentials_type == 'accessToken':
|
||||
self.__username = str(credentials["accessToken"])
|
||||
if credentials.get('type') == 'usernamePassword':
|
||||
if credentials_type == 'usernamePassword':
|
||||
if credentials.get("username") is not None:
|
||||
self.__username = str(credentials["username"])
|
||||
if credentials.get("password") is not None:
|
||||
|
|
|
|||
|
|
@ -116,8 +116,20 @@ class RemoteConfigurator:
|
|||
config['class'] = connector.get('class')
|
||||
connectors_config.append(config)
|
||||
|
||||
adopted_general_config = {}
|
||||
adopted_general_config.update(self.general_configuration)
|
||||
|
||||
security_section = adopted_general_config.get('security')
|
||||
security_type = security_section.get('type', 'accessToken')
|
||||
if security_type == 'accessToken':
|
||||
security_section.pop('clientId', None)
|
||||
security_section.pop('username', None)
|
||||
security_section.pop('password', None)
|
||||
elif security_type == 'usernamePassword':
|
||||
security_section.pop('accessToken', None)
|
||||
|
||||
return {
|
||||
'thingsboard': self.general_configuration,
|
||||
'thingsboard': adopted_general_config,
|
||||
'storage': self.storage_configuration,
|
||||
'grpc': self.grpc_configuration,
|
||||
'connectors': connectors_config
|
||||
|
|
@ -456,7 +468,8 @@ class RemoteConfigurator:
|
|||
for connector in self.connectors_configuration:
|
||||
connector_identifier = connector.get(identifier_parameter)
|
||||
if connector_identifier is None:
|
||||
LOG.warning('Connector %s has no identifier parameter %s, it will be skipped.', connector, identifier_parameter)
|
||||
LOG.warning('Connector %s has no identifier parameter %s, it will be skipped.',
|
||||
connector, identifier_parameter)
|
||||
continue
|
||||
if connector[identifier_parameter] == config.get(identifier_parameter):
|
||||
found_connectors.append(connector)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user