summaryrefslogtreecommitdiff
path: root/voctocore/lib/config.py
blob: 775ea5cbb2f08401822bad7b64642764716e080c (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. '/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)