exec-notify/execNotifyDir/config.py

35 lines
692 B
Python
Raw Normal View History

2020-12-06 13:18:32 +01:00
from pathlib import Path
import configparser
2020-12-06 16:40:03 +01:00
from execNotifyDir import util
2020-12-06 13:18:32 +01:00
def getHostAndPort():
return config['mail']['host'], config['mail']['port']
def getPassword():
return config['mail']['password']
def getFrom():
return config['mail']['from'] # used for mail login as well
def getTo():
return config['mail']['to']
def getErrorFile() -> Path:
return Path(config['file']['errorfile'])
def _getCfgFile() -> Path:
return _getCfgDir().joinpath('cfg.ini')
def _getCfgDir() -> Path:
2020-12-06 16:40:03 +01:00
return util.getProjectBase().joinpath('execNotifyDir').joinpath('config')
2020-12-06 13:18:32 +01:00
config: configparser.ConfigParser = configparser.ConfigParser()
config.read(_getCfgFile())