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