From 3b9da3389f635f04b934272dee4a25580cd63c45 Mon Sep 17 00:00:00 2001 From: samson0v Date: Wed, 29 Nov 2023 15:23:34 +0200 Subject: [PATCH] Fixed config convertartation --- thingsboard_gateway/gateway/tb_gateway_service.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/thingsboard_gateway/gateway/tb_gateway_service.py b/thingsboard_gateway/gateway/tb_gateway_service.py index 6bea1f38..ad540de6 100644 --- a/thingsboard_gateway/gateway/tb_gateway_service.py +++ b/thingsboard_gateway/gateway/tb_gateway_service.py @@ -342,11 +342,12 @@ class TBGatewayService: config = {} try: - with open(''.join(config_file.split('.')[:-1]) + '.yaml') as general_config: + filename = ''.join(config_file.split('.')[:-1]) + with open(filename + '.yaml') as general_config: config = safe_load(general_config) - with open(config_file, 'w') as file: - file.writelines(dumps(config)) + with open(filename + '.json', 'w') as file: + file.writelines(dumps(config, indent=' ')) except Exception as e: log.exception('Failed to load configuration file:\n %s', e)