added config.port
This commit is contained in:
14
config.py
14
config.py
@@ -8,10 +8,12 @@ class Config:
|
|||||||
Notifier config dataclass.
|
Notifier config dataclass.
|
||||||
|
|
||||||
* `base_url`: url of domain
|
* `base_url`: url of domain
|
||||||
|
* `port`: server port (default **3001**)
|
||||||
* `teletoken`: telegram api token.
|
* `teletoken`: telegram api token.
|
||||||
* `param bot_owner`: telegram id of bot owner.
|
* `bot_owner`: telegram id of bot owner.
|
||||||
"""
|
"""
|
||||||
base_url: str
|
base_url: str
|
||||||
|
port: int
|
||||||
teletoken: str
|
teletoken: str
|
||||||
bot_owner: int
|
bot_owner: int
|
||||||
|
|
||||||
@@ -45,6 +47,12 @@ _base_url = getenv('LTLNOTIFIER_BASE_URL')
|
|||||||
if not _base_url:
|
if not _base_url:
|
||||||
raise ConfigError('virtual environment LTLNOTIFIER_BASE_URL not set')
|
raise ConfigError('virtual environment LTLNOTIFIER_BASE_URL not set')
|
||||||
|
|
||||||
config = Config(teletoken=_teletoken, bot_owner=_bot_owner, base_url=_base_url)
|
_port = getenv('LTLNOTIFIER_PORT')
|
||||||
|
_port = int(_port) if _port.isdigit() else 3001
|
||||||
|
|
||||||
__all__ = ['Config', 'config']
|
config = Config(teletoken=_teletoken,
|
||||||
|
port=_port,
|
||||||
|
bot_owner=_bot_owner,
|
||||||
|
base_url=_base_url)
|
||||||
|
|
||||||
|
__all__ = ('Config', 'config')
|
||||||
|
|||||||
@@ -7,3 +7,6 @@ from config import config
|
|||||||
telegram_bot = Bot(token=config.teletoken)
|
telegram_bot = Bot(token=config.teletoken)
|
||||||
telegram_dispatcher = Dispatcher(telegram_bot)
|
telegram_dispatcher = Dispatcher(telegram_bot)
|
||||||
telegram_dispatcher.middleware.setup(LoggingMiddleware())
|
telegram_dispatcher.middleware.setup(LoggingMiddleware())
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ('telegram_bot', telegram_dispatcher)
|
||||||
0
web/routes.py
Normal file
0
web/routes.py
Normal file
0
web/views.py
Normal file
0
web/views.py
Normal file
Reference in New Issue
Block a user