diff --git a/tsstats/__main__.py b/tsstats/__main__.py index d805047..e968f08 100644 --- a/tsstats/__main__.py +++ b/tsstats/__main__.py @@ -25,9 +25,9 @@ def main(config_path='config.ini', id_map_path='id_map.json'): else: id_map = {} - log_path, output_path = parse_config(config_path) - clients = parse_logs(log_path, ident_map=id_map) - render_template(clients, output=output_path) + log, output = parse_config(config_path) + clients = parse_logs(log, ident_map=id_map) + render_template(clients, output=output) if __name__ == '__main__': diff --git a/tsstats/config.py b/tsstats/config.py index ebd2654..8b432cc 100644 --- a/tsstats/config.py +++ b/tsstats/config.py @@ -12,10 +12,8 @@ def parse_config(config_path): config = ConfigParser() config.read(config_path) if not config.has_section('General') or not \ - (config.has_option('General', 'logfile') and - config.has_option('General', 'outputfile')): + (config.has_option('General', 'log') and + config.has_option('General', 'output')): raise InvalidConfig - - log_path = abspath(config.get('General', 'logfile')) - output_path = abspath(config.get('General', 'outputfile')) - return log_path, output_path + return (abspath(config.get('General', 'log')), + abspath(config.get('General', 'output'))) diff --git a/tsstats/tests/res/config.ini b/tsstats/tests/res/config.ini index 6e5f4f6..28e238e 100644 --- a/tsstats/tests/res/config.ini +++ b/tsstats/tests/res/config.ini @@ -1,3 +1,3 @@ [General] -logfile = tsstats/tests/res/test.log -outputfile = tsstats/tests/res/output.html +log = tsstats/tests/res/test.log +output = tsstats/tests/res/output.html diff --git a/tsstats/tests/test_config.py b/tsstats/tests/test_config.py index 0351fb0..c9becbc 100644 --- a/tsstats/tests/test_config.py +++ b/tsstats/tests/test_config.py @@ -42,10 +42,9 @@ def test_invalid_config(config): def test_config(config): create_config({ - 'logfile': 'tsstats/tests/res/test.log', - 'outputfile': 'output.html', - 'debug': 'true' + 'log': 'tsstats/tests/res/test.log', + 'output': 'output.html', }) - log_path, output_path = parse_config(configpath) - assert log_path == abspath('tsstats/tests/res/test.log') - assert output_path == abspath('output.html') + log, output = parse_config(configpath) + assert log == abspath('tsstats/tests/res/test.log') + assert output == abspath('output.html')