mirror of
https://github.com/KevinMidboe/transatlanticTorrentExpress.git
synced 2025-12-08 20:48:45 +00:00
Moved function for fetching config into separate utils file.
This commit is contained in:
18
utils.py
Normal file
18
utils.py
Normal 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
|
||||
Reference in New Issue
Block a user