mirror of
https://github.com/avipatilpro/FileStreamBot.git
synced 2026-01-15 22:32:53 -03:00
🚀 Added Heroku Support
- Added Heroku Support - Added a Readme since the repo page was looking so bad. - Removed unused variables
This commit is contained in:
@@ -14,7 +14,7 @@ from .vars import Var
|
||||
from aiohttp import web
|
||||
from .server import web_server
|
||||
|
||||
ppath = f"WebStreamer/bot/plugins/*.py"
|
||||
ppath = "WebStreamer/bot/plugins/*.py"
|
||||
files = glob.glob(ppath)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
@@ -43,12 +43,14 @@ async def start_services():
|
||||
print('------------------- Initalizing Web Server -------------------')
|
||||
app = web.AppRunner(await web_server())
|
||||
await app.setup()
|
||||
bind_address = "0.0.0.0" if Var.ENV else Var.FQDN
|
||||
bind_address = "0.0.0.0" if Var.ON_HEROKU else Var.FQDN
|
||||
await web.TCPSite(app, bind_address, Var.PORT).start()
|
||||
print('\n')
|
||||
print('----------------------- Service Started -----------------------')
|
||||
print(' bot =>> {}'.format((await StreamBot.get_me()).first_name))
|
||||
print(' server ip =>> {}:{}'.format(bind_address, Var.PORT))
|
||||
if Var.ON_HEROKU:
|
||||
print(' app runnng on =>> {}'.format(Var.FQDN))
|
||||
print('---------------------------------------------------------------')
|
||||
await idle()
|
||||
|
||||
|
||||
@@ -7,19 +7,18 @@ from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
class Var(object):
|
||||
ENV = bool(getenv('ENV', False))
|
||||
API_ID = int(getenv('API_ID'))
|
||||
API_HASH = str(getenv('API_HASH'))
|
||||
BOT_TOKEN = str(getenv('BOT_TOKEN'))
|
||||
SLEEP_THRESHOLD = int(getenv('SLEEP_THRESHOLD', '300'))
|
||||
SLEEP_THRESHOLD = int(getenv('SLEEP_THRESHOLD', '60'))
|
||||
WORKERS = int(getenv('WORKERS', '3'))
|
||||
BIN_CHANNEL = int(getenv('BIN_CHANNEL', None))
|
||||
FQDN = str(getenv('FQDN', 'localhost'))
|
||||
BIN_CHANNEL = int(getenv('BIN_CHANNEL', None))
|
||||
PORT = int(getenv('PORT', 8080))
|
||||
BIND_ADRESS = str(getenv('BIND_ADRESS', '0.0.0.0'))
|
||||
CACHE_DIR = str(getenv('CACHE_DIR', 'WebStreamer/bot/cache'))
|
||||
OWNER_ID = int(getenv('OWNER_ID'))
|
||||
BIND_ADRESS = str(getenv('WEB_SERVER_BIND_ADDRESS', '0.0.0.0'))
|
||||
OWNER_ID = int(getenv('OWNER_ID', None)) #TODO
|
||||
if 'DYNO' in environ:
|
||||
ON_HEROKU = True
|
||||
APP_NAME = str(getenv('APP_NAME'))
|
||||
else:
|
||||
ON_HEROKU = False
|
||||
ON_HEROKU = False
|
||||
FQDN = str(getenv('FQDN', BIND_ADRESS)) if not ON_HEROKU else APP_NAME+'.herokuapp.com'
|
||||
Reference in New Issue
Block a user