Moved function for fetching config into separate utils file.

This commit is contained in:
2019-04-30 19:23:04 +02:00
parent df5246b304
commit 206606ca1e
2 changed files with 19 additions and 17 deletions

18
utils.py Normal file
View File

@@ -0,0 +1,18 @@
#!/bin/usr/python3
import os
from configparser import ConfigParser
def getConfig():
# logger.debug('Reading config')
pwd = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(pwd, 'config.ini')
if not os.path.isfile(path):
print('Please fill out and rename config file. Check README for more info.')
exit(0)
config = ConfigParser()
config.read(path)
# logger.debug('Sections parsed: {}'.format(config.sections()))
return config