From 892680fe4d925e768186e34dacfd6f0088774c7b Mon Sep 17 00:00:00 2001
From: Thor77 <xXThor77Xx@gmail.com>
Date: Sat, 25 Jun 2016 20:34:17 +0200
Subject: [PATCH] add onlinedc config-option

* inverse of --noonlinedc
---
 tsstats/__main__.py          | 2 +-
 tsstats/config.py            | 5 ++++-
 tsstats/tests/test_config.py | 6 ++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tsstats/__main__.py b/tsstats/__main__.py
index e469b92..fe23982 100644
--- a/tsstats/__main__.py
+++ b/tsstats/__main__.py
@@ -53,7 +53,7 @@ def main(config=None, idmap=None, log=None,
         config = abspath(config)
         if not exists(config):
             logger.fatal('config not found (%s)', config)
-        idmap, log, output, debug = parse_config(config)
+        idmap, log, output, debug, noonlinedc = parse_config(config)
         if debug:
             logger.setLevel(logging.DEBUG)
 
diff --git a/tsstats/config.py b/tsstats/config.py
index 1ad4c36..498bd54 100644
--- a/tsstats/config.py
+++ b/tsstats/config.py
@@ -28,10 +28,13 @@ def parse_config(config_path):
     config_items = dict(config.items('General'))
     if 'debug' in config_items:
         config_items['debug'] = config.getboolean('General', 'debug')
+    if 'onlinedc' in config_items:
+        config_items['onlinedc'] = config.getboolean('General', 'onlinedc')
     logger.debug('raw config: %s', config_items)
     return (
         config_items.get('idmap'),
         config_items.get('log'),
         config_items.get('output'),
-        config_items.get('debug', False)
+        config_items.get('debug', False),
+        config_items.get('onlinedc', True)
     )
diff --git a/tsstats/tests/test_config.py b/tsstats/tests/test_config.py
index 5a84bbb..15b361f 100644
--- a/tsstats/tests/test_config.py
+++ b/tsstats/tests/test_config.py
@@ -35,10 +35,12 @@ def test_config(config):
         'idmap': 'tsstats/tests/res/id_map.json',
         'log': 'tsstats/tests/res/test.log',
         'output': 'output.html',
-        'debug': 'true'
+        'debug': 'true',
+        'onlinedc': 'false'
     })
-    idmap, log, output, debug = parse_config(configpath)
+    idmap, log, output, debug, onlinedc = parse_config(configpath)
     assert idmap == 'tsstats/tests/res/id_map.json'
     assert log == 'tsstats/tests/res/test.log'
     assert output == 'output.html'
     assert debug is True
+    assert onlinedc is False