Merge branch 'BATON-ARCH-012-backend_dev'
This commit is contained in:
commit
69d01ac3a6
3 changed files with 6 additions and 2 deletions
|
|
@ -3,6 +3,8 @@ BOT_TOKEN=your_telegram_bot_token_here
|
||||||
CHAT_ID=-1001234567890
|
CHAT_ID=-1001234567890
|
||||||
WEBHOOK_SECRET=your_random_secret_here
|
WEBHOOK_SECRET=your_random_secret_here
|
||||||
WEBHOOK_URL=https://yourdomain.com/api/webhook/telegram
|
WEBHOOK_URL=https://yourdomain.com/api/webhook/telegram
|
||||||
|
# Set to false for local development without ngrok
|
||||||
|
WEBHOOK_ENABLED=true
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_PATH=baton.db
|
DB_PATH=baton.db
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,5 @@ CHAT_ID: str = _require("CHAT_ID")
|
||||||
DB_PATH: str = os.getenv("DB_PATH", "baton.db")
|
DB_PATH: str = os.getenv("DB_PATH", "baton.db")
|
||||||
WEBHOOK_SECRET: str = _require("WEBHOOK_SECRET")
|
WEBHOOK_SECRET: str = _require("WEBHOOK_SECRET")
|
||||||
WEBHOOK_URL: str = _require("WEBHOOK_URL")
|
WEBHOOK_URL: str = _require("WEBHOOK_URL")
|
||||||
|
WEBHOOK_ENABLED: bool = os.getenv("WEBHOOK_ENABLED", "true").lower() == "true"
|
||||||
FRONTEND_ORIGIN: str = os.getenv("FRONTEND_ORIGIN", "http://localhost:3000")
|
FRONTEND_ORIGIN: str = os.getenv("FRONTEND_ORIGIN", "http://localhost:3000")
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ async def lifespan(app: FastAPI):
|
||||||
await db.init_db()
|
await db.init_db()
|
||||||
logger.info("Database initialized")
|
logger.info("Database initialized")
|
||||||
|
|
||||||
|
if config.WEBHOOK_ENABLED:
|
||||||
await telegram.set_webhook(url=config.WEBHOOK_URL, secret=config.WEBHOOK_SECRET)
|
await telegram.set_webhook(url=config.WEBHOOK_URL, secret=config.WEBHOOK_SECRET)
|
||||||
logger.info("Webhook registered")
|
logger.info("Webhook registered")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue