Update config_init.py

Fix issue where server.py wouldn't run if the [sync] portion of the config.ini was commented out.
This commit is contained in:
TC² 2024-06-25 18:15:46 -04:00 committed by GitHub
parent 64352d4ce4
commit 4f385cffcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,10 +7,15 @@ import serial.tools.list_ports
def initialize_config():
config = configparser.ConfigParser()
config.read('config.ini')
interface_type = config['interface']['type']
hostname = config['interface'].get('hostname', None)
port = config['interface'].get('port', None)
bbs_nodes = config['sync']['bbs_nodes'].split(',')
port = config['interface'].get('port', None)
bbs_nodes = config.get('sync', 'bbs_nodes', fallback='').split(',')
if bbs_nodes == ['']:
bbs_nodes = []
return config, interface_type, hostname, port, bbs_nodes
def get_interface(interface_type, hostname=None, port=None):