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

Fixed config convertartation

This commit is contained in:
samson0v
2023-11-29 15:23:34 +02:00
parent 5b7c2ce89f
commit 3b9da3389f

View File

@@ -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)