introduce config checking infrastructure
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
from http.server import HTTPServer
|
||||
from owrx.http import RequestHandler
|
||||
from owrx.config import PropertyManager
|
||||
from owrx.config import PropertyManager, Config
|
||||
from owrx.feature import FeatureDetector
|
||||
from owrx.sdr import SdrService
|
||||
from socketserver import ThreadingMixIn
|
||||
@ -12,6 +12,7 @@ from owrx.pskreporter import PskReporter
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ThreadedHttpServer(ThreadingMixIn, HTTPServer):
|
||||
@ -32,13 +33,22 @@ Author contact info: Jakob Ketterl, DD5JFK <dd5jfk@darc.de>
|
||||
|
||||
pm = PropertyManager.getSharedInstance().loadConfig()
|
||||
|
||||
configErrors = Config.validateConfig()
|
||||
if configErrors:
|
||||
logger.error(
|
||||
"your configuration contains errors. please address the following errors:"
|
||||
)
|
||||
for e in configErrors:
|
||||
logger.error(e)
|
||||
return
|
||||
|
||||
featureDetector = FeatureDetector()
|
||||
if not featureDetector.is_available("core"):
|
||||
print(
|
||||
logger.error(
|
||||
"you are missing required dependencies to run openwebrx. "
|
||||
"please check that the following core requirements are installed:"
|
||||
)
|
||||
print(", ".join(featureDetector.get_requirements("core")))
|
||||
logger.error(", ".join(featureDetector.get_requirements("core")))
|
||||
return
|
||||
|
||||
# Get error messages about unknown / unavailable features as soon as possible
|
||||
|
Reference in New Issue
Block a user