1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env python
- import configparser;
- import sys
- class Server():
- def __init__(self, config : configparser.ConfigParser):
- self.Address = None
- self.PortReceiver = None
- self.PortNotification = None
- self.WebUiUrl = None
- self.WebUiSequenceNotification = None
- self.WebUiConfigurationReceiver = None
- # search the required sections
- for key in config:
- if 'address' == key:
- self.Address = config['address']
- elif 'portreceiver' == key:
- self.PortReceiver = int(config['portreceiver'])
- elif 'portnotification' == key:
- self.PortNotification = int(config['portnotification'])
- if self.Address is None:
- sys.stderr.write('No server-address configuration found!')
- sys.exit(-1)
- if self.PortReceiver is None:
- sys.stderr.write('No server-port-receiver configuration found!')
- sys.exit(-1)
- if self.PortNotification is None:
- sys.stderr.write('No server-port-notification configuration found!')
- sys.exit(-1)
|