Remove hardcoded tokens, opt for environment variable

This commit is contained in:
latan 2023-08-10 15:00:44 +03:00
parent 879b333a11
commit 6b2b3f48a7
7 changed files with 11 additions and 21 deletions

View file

@ -3,6 +3,7 @@ This example shows how to use webhook with SSL certificate.
"""
import logging
import ssl
from os import getenv
from aiohttp import web
@ -14,9 +15,7 @@ from aiogram.utils.markdown import hbold
from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application
# Bot token can be obtained via https://t.me/BotFather
TOKEN = "42:TOKEN"
# However, is recommended to get the token from environment variable:
# TOKEN = getenv("BOT_TOKEN")
TOKEN = getenv("BOT_TOKEN")
# Webserver settings