mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-15 16:10:39 +03:00
add ci tests in docker compose (#11)
This commit is contained in:
@@ -40,6 +40,8 @@ class BotApplication:
|
||||
logger.info("webhook has been deleted")
|
||||
|
||||
async def polling(self) -> None:
|
||||
if self.settings.STAGE == "runtests":
|
||||
return None
|
||||
await self.application.initialize()
|
||||
await self.application.start()
|
||||
await self.application.updater.start_polling() # type: ignore
|
||||
|
||||
@@ -13,7 +13,7 @@ DOMAIN="http://localhost"
|
||||
URL_PREFIX=
|
||||
|
||||
# set to true to start with webhook. Else bot will start on polling method
|
||||
START_WITH_WEBHOOK="true"
|
||||
START_WITH_WEBHOOK="false"
|
||||
|
||||
# quantity of workers for uvicorn
|
||||
WORKERS_COUNT=1
|
||||
|
||||
@@ -13,7 +13,7 @@ DOMAIN="http://localhost"
|
||||
URL_PREFIX=
|
||||
|
||||
# set to true to start with webhook. Else bot will start on polling method
|
||||
START_WITH_WEBHOOK="true"
|
||||
START_WITH_WEBHOOK="false"
|
||||
|
||||
# quantity of workers for uvicorn
|
||||
WORKERS_COUNT=1
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from functools import cached_property
|
||||
from os import environ
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from constants import API_PREFIX
|
||||
from dotenv import load_dotenv
|
||||
from pydantic import HttpUrl
|
||||
from pydantic import HttpUrl, ValidationInfo, field_validator
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
BASE_DIR = Path(__file__).parent.parent
|
||||
@@ -51,6 +52,12 @@ class AppSettings(SentrySettings, BaseSettings):
|
||||
# Enable uvicorn reloading
|
||||
RELOAD: bool = False
|
||||
|
||||
@field_validator("START_WITH_WEBHOOK")
|
||||
def star_with_webhook_validator(cls, field_value: Any, info: ValidationInfo) -> Any:
|
||||
if field_value == "false":
|
||||
return False
|
||||
return field_value
|
||||
|
||||
@cached_property
|
||||
def api_prefix(self) -> str:
|
||||
if self.URL_PREFIX:
|
||||
|
||||
Reference in New Issue
Block a user