fix config verification

This commit is contained in:
Jakob Ketterl 2021-02-06 22:08:27 +01:00
parent 9357d57a28
commit 617bed91c4
2 changed files with 9 additions and 17 deletions

View File

@ -48,14 +48,9 @@ Support and info: https://groups.io/g/openwebrx
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, handleSignal)
pm = Config.get()
configErrors = Config.validateConfig()
if configErrors:
logger.error("your configuration contains errors. please address the following errors:")
for e in configErrors:
logger.error(e)
return
# config warmup
Config.validateConfig()
coreConfig = CoreConfig()
featureDetector = FeatureDetector()
if not featureDetector.is_available("core"):
@ -73,7 +68,7 @@ Support and info: https://groups.io/g/openwebrx
Services.start()
try:
server = ThreadedHttpServer(("0.0.0.0", CoreConfig().get_web_port()), RequestHandler)
server = ThreadedHttpServer(("0.0.0.0", coreConfig.get_web_port()), RequestHandler)
server.serve_forever()
except SignalException:
WebSocketConnection.closeAll()

View File

@ -14,13 +14,9 @@ class ConfigNotFoundException(Exception):
pass
class ConfigError(object):
class ConfigError(Exception):
def __init__(self, key, message):
self.key = key
self.message = message
def __str__(self):
return "Configuration Error (key: {0}): {1}".format(self.key, self.message)
super().__init__("Configuration Error (key: {0}): {1}".format(key, message))
class ConfigMigrator(ABC):
@ -167,8 +163,9 @@ class Config:
@staticmethod
def validateConfig():
# no config check atm
return []
# no config checks atm
# just basic loading verification
Config.get()
@staticmethod
def _migrate(config):