Read setup variables from environment variables
Also Adds support for heroku env variables Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
3af2d9e3f3
commit
b4cd971930
|
|
@ -1,10 +1,10 @@
|
|||
import logging
|
||||
import aria2p
|
||||
import threading
|
||||
import telegram.ext as tg
|
||||
from telegram import Bot
|
||||
import os
|
||||
import configparser
|
||||
from dotenv import load_dotenv
|
||||
from telegram import Bot
|
||||
import telegram.ext as tg
|
||||
import time
|
||||
|
||||
botStartTime = time.time()
|
||||
|
|
@ -16,13 +16,12 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s
|
|||
handlers=[logging.FileHandler('log.txt'), logging.StreamHandler()],
|
||||
level=logging.INFO)
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('bot/config.ini')
|
||||
load_dotenv('config.env')
|
||||
|
||||
Interval = []
|
||||
|
||||
def getConfig(name: str):
|
||||
return config['DEFAULT'][name]
|
||||
return os.environ[name]
|
||||
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
|
@ -75,7 +74,7 @@ except KeyError as e:
|
|||
LOGGER.error("One or more env variables missing! Exiting now")
|
||||
exit(1)
|
||||
|
||||
bot = Bot(BOT_TOKEN)
|
||||
bot = Bot(BOT_TOKEN)
|
||||
updater = tg.Updater(token=BOT_TOKEN)
|
||||
dispatcher = updater.dispatcher
|
||||
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@ google-api-python-client>=1.7.11,<1.7.20
|
|||
google-auth-httplib2>=0.0.3,<0.1.0
|
||||
google-auth-oauthlib>=0.4.1,<0.10.0
|
||||
aria2p>=0.3.0,<0.10.0
|
||||
python-dotenv>=0.10
|
||||
|
|
|
|||
Loading…
Reference in New Issue