diff --git a/config.py b/config.py index c36c977..19d922d 100644 --- a/config.py +++ b/config.py @@ -8,10 +8,12 @@ class Config: Notifier config dataclass. * `base_url`: url of domain + * `port`: server port (default **3001**) * `teletoken`: telegram api token. - * `param bot_owner`: telegram id of bot owner. + * `bot_owner`: telegram id of bot owner. """ base_url: str + port: int teletoken: str bot_owner: int @@ -45,6 +47,12 @@ _base_url = getenv('LTLNOTIFIER_BASE_URL') if not _base_url: 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') diff --git a/telegram/__init__.py b/telegram/__init__.py index 92d33eb..1a354e9 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -7,3 +7,6 @@ from config import config telegram_bot = Bot(token=config.teletoken) telegram_dispatcher = Dispatcher(telegram_bot) telegram_dispatcher.middleware.setup(LoggingMiddleware()) + + +__all__ = ('telegram_bot', telegram_dispatcher) \ No newline at end of file diff --git a/web/routes.py b/web/routes.py new file mode 100644 index 0000000..e69de29 diff --git a/web/views.py b/web/views.py new file mode 100644 index 0000000..e69de29