fix config verification
This commit is contained in:
parent
9357d57a28
commit
617bed91c4
@ -48,14 +48,9 @@ Support and info: https://groups.io/g/openwebrx
|
|||||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||||
signal.signal(sig, handleSignal)
|
signal.signal(sig, handleSignal)
|
||||||
|
|
||||||
pm = Config.get()
|
# config warmup
|
||||||
|
Config.validateConfig()
|
||||||
configErrors = Config.validateConfig()
|
coreConfig = CoreConfig()
|
||||||
if configErrors:
|
|
||||||
logger.error("your configuration contains errors. please address the following errors:")
|
|
||||||
for e in configErrors:
|
|
||||||
logger.error(e)
|
|
||||||
return
|
|
||||||
|
|
||||||
featureDetector = FeatureDetector()
|
featureDetector = FeatureDetector()
|
||||||
if not featureDetector.is_available("core"):
|
if not featureDetector.is_available("core"):
|
||||||
@ -73,7 +68,7 @@ Support and info: https://groups.io/g/openwebrx
|
|||||||
Services.start()
|
Services.start()
|
||||||
|
|
||||||
try:
|
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()
|
server.serve_forever()
|
||||||
except SignalException:
|
except SignalException:
|
||||||
WebSocketConnection.closeAll()
|
WebSocketConnection.closeAll()
|
||||||
|
@ -14,13 +14,9 @@ class ConfigNotFoundException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfigError(object):
|
class ConfigError(Exception):
|
||||||
def __init__(self, key, message):
|
def __init__(self, key, message):
|
||||||
self.key = key
|
super().__init__("Configuration Error (key: {0}): {1}".format(key, message))
|
||||||
self.message = message
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return "Configuration Error (key: {0}): {1}".format(self.key, self.message)
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigMigrator(ABC):
|
class ConfigMigrator(ABC):
|
||||||
@ -167,8 +163,9 @@ class Config:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validateConfig():
|
def validateConfig():
|
||||||
# no config check atm
|
# no config checks atm
|
||||||
return []
|
# just basic loading verification
|
||||||
|
Config.get()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _migrate(config):
|
def _migrate(config):
|
||||||
|
Loading…
Reference in New Issue
Block a user