aboutsummaryrefslogtreecommitdiff
path: root/voctocore/lib/config.py
blob: ebb9e1e27eeb4961085537750e49757a3bf0d507 (plain)
  1. import os.path
  2. from configparser import SafeConfigParser
  3. from lib.args import Args
  4. __all__ = ['Config']
  5. def getlist(self, section, option):
  6. return [x.strip() for x in self.get(section, option).split(',')]
  7. SafeConfigParser.getlist = getlist
  8. files = [
  9. os.path.join(os.path.dirname(os.path.realpath(__file__)), '../default-config.ini'),
  10. os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config.ini'),
  11. '/etc/voctomix.ini',
  12. os.path.expanduser('~/.voctomix.ini'),
  13. ]
  14. if Args.ini_file is not None:
  15. files.append(Args.ini_file)
  16. Config = SafeConfigParser()
  17. Config.read(files)