From abadfdc9b1344ccce8c15914d8aa6fb3cf894272 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Mon, 16 Nov 2020 18:16:25 +0100 Subject: [PATCH] [config] Centralize config reading --- bob/devtools/config.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bob/devtools/config.py diff --git a/bob/devtools/config.py b/bob/devtools/config.py new file mode 100755 index 00000000..84282d3d --- /dev/null +++ b/bob/devtools/config.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# coding=utf-8 + +"""Reads and treats configuration files""" + + +import os +import configparser + + +def read_config(): + """Reads and resolves configuration files, returns a dictionary with read + values""" + + data = configparser.ConfigParser() + cfg = os.path.expanduser("~/.bdtrc") + if os.path.exists(cfg): + data.read(cfg) + return data -- GitLab