Check config and fail early
This commit is contained in:
parent
fb767eba1e
commit
6007908113
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
from httplib2 import Http
|
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import signal
|
import signal
|
||||||
import faulthandler
|
import faulthandler
|
||||||
from qbittorrentapi import Client, TorrentStates
|
from qbittorrentapi import Client, TorrentStates
|
||||||
|
@ -186,6 +186,14 @@ def main():
|
||||||
logger.addHandler(logHandler)
|
logger.addHandler(logHandler)
|
||||||
logger.setLevel(config["log_level"])
|
logger.setLevel(config["log_level"])
|
||||||
|
|
||||||
|
if not config["host"]:
|
||||||
|
logger.error("No host specified, please set QBITTORRENT_HOST environment variable")
|
||||||
|
sys.exit(1)
|
||||||
|
if not config["post"]:
|
||||||
|
logger.error("No post specified, please set QBITTORRENT_PORT environment variable")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# Register our custom collector
|
# Register our custom collector
|
||||||
logger.info("Exporter is starting up")
|
logger.info("Exporter is starting up")
|
||||||
REGISTRY.register(QbittorrentMetricsCollector(config))
|
REGISTRY.register(QbittorrentMetricsCollector(config))
|
||||||
|
|
Loading…
Reference in a new issue