Skip to content

Commit 5980edb

Browse files
committed
fix(config): changed env-vars reading method
from file reading(load_values) to global(for docker, load_dotenv)
1 parent 84e3647 commit 5980edb

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
2-
bot:
2+
faststicker-tgbot:
33
image: ghcr.io/okiscape/faststicker-tgbot:latest
44
restart: unless-stopped
55
container_name: faststicker-tgbot

utils/stores/config.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
from dotenv import dotenv_values
1+
import os
22

3-
_env = dotenv_values()
3+
from dotenv import load_dotenv
4+
5+
load_dotenv()
46

57
import pytz
68
from aiogram.client.default import DefaultBotProperties
@@ -14,4 +16,9 @@
1416

1517

1618
class env:
17-
BOT_TOKEN = _env["BOT_TOKEN"]
19+
BOT_TOKEN = os.environ.get("BOT_TOKEN")
20+
21+
22+
if not env.BOT_TOKEN:
23+
print("BOT_TOKEN was not found!!!")
24+
exit(1)

0 commit comments

Comments
 (0)