mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 10:04:33 +02:00
adjusted config
This commit is contained in:
parent
7f86ab2ece
commit
e90d1f7716
|
@ -1,5 +1,5 @@
|
|||
[NETWORK]
|
||||
modemport = 3050
|
||||
modemport = 5000
|
||||
|
||||
[STATION]
|
||||
mycall = AA1AAA
|
||||
|
|
|
@ -147,9 +147,7 @@ class CONFIG:
|
|||
self.parser.set(section, setting, str(default_value))
|
||||
self.log.info(f"[CFG] Adding missing setting: {section}.{setting}")
|
||||
|
||||
self.write_to_file()
|
||||
|
||||
|
||||
return self.write_to_file()
|
||||
|
||||
# Handle special setting data type conversion
|
||||
# is_writing means data from a dict being writen to the config file
|
||||
|
@ -177,7 +175,6 @@ class CONFIG:
|
|||
def write(self, data):
|
||||
# Validate config data before writing
|
||||
self.validate_data(data)
|
||||
|
||||
for section in data:
|
||||
# init section if it doesn't exist yet
|
||||
if not section.upper() in self.parser.keys():
|
||||
|
@ -186,9 +183,11 @@ class CONFIG:
|
|||
for setting in data[section]:
|
||||
new_value = self.handle_setting(
|
||||
section, setting, data[section][setting], True)
|
||||
self.parser[section][setting] = str(new_value)
|
||||
|
||||
self.write_to_file()
|
||||
try:
|
||||
self.parser[section][setting] = str(new_value)
|
||||
except Exception as e:
|
||||
self.log.error("[CFG] error setting config key", e=e)
|
||||
return self.write_to_file()
|
||||
|
||||
def write_to_file(self):
|
||||
# Write config data to file
|
||||
|
|
Loading…
Reference in a new issue