Commit 628d427c authored by Robin Obůrka's avatar Robin Obůrka

msgloop: First version of Config class integration

parent fa77b84a
......@@ -26,4 +26,8 @@ def get_arg_parser():
help="Enables debug mode in logger"
parser.add_argument('-c', '--config',
help="Path to configuration file"
return parser
......@@ -12,6 +12,7 @@ from .network import get_arg_parser
from .messages import encode_msg, parse_msg
from .exceptions import SetupError, UndefinedSocketError, InvalidMsgError
from .monitoring import Monitoring
from .config import Config
class LoopHardFail(Exception):
......@@ -35,7 +36,7 @@ class SNBox():
:param box_name: Unique identification of the box in Sentinel network.
:param argparser: Enriched argparser - see :func:`sn.get_arg_parser`
def __init__(self, box_name, argparser=None):
def __init__(self, box_name, argparser=None, default_config=None):
"""Initialize common Box resources.
The most important resources:
......@@ -65,6 +66,20 @@ class SNBox():
self.mon = Monitoring(box_name, self.socket_monitoring)
self.received_messages = self.mon.get_counter("msg_recv")
self.sent_messages = self.mon.get_counter("msg_sent")
# Configuration
self.config = Config()
def _load_configuration(self, default_config):
if default_config:
# Mainly for development environment
self.config.from_file("local.cfg", silent=True)
if self.args.config:
# Core methods - Will be implemented in non-abstract boxes
def check_configuration(self):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment