Fix allowed chats parsing
This commit is contained in:
parent
350850d23e
commit
ca68d8a631
@ -46,9 +46,20 @@ def load_env() -> None:
|
||||
load_env()
|
||||
|
||||
BOT_TOKEN = os.getenv("TG_BOT_TOKEN")
|
||||
ALLOWED_CHATS = {
|
||||
int(x.strip()) for x in os.getenv("ALLOWED_CHATS", "").split(",") if x.strip().isdigit()
|
||||
}
|
||||
raw_allowed = os.getenv("ALLOWED_CHATS", "")
|
||||
ALLOWED_CHATS: set[int] = set()
|
||||
|
||||
for part in raw_allowed.split(","):
|
||||
part = part.strip()
|
||||
if not part:
|
||||
continue
|
||||
try:
|
||||
ALLOWED_CHATS.add(int(part))
|
||||
except ValueError:
|
||||
log.warning(f"Не могу распарсить chat_id '{part}' из ALLOWED_CHATS, пропускаю")
|
||||
|
||||
log.info(f"ALLOWED_CHATS инициализирован: {ALLOWED_CHATS}")
|
||||
|
||||
# Путь к kubectl НА АДМИНБОКСЕ
|
||||
KUBECTL = os.getenv("KUBECTL_BIN", "kubectl")
|
||||
CONTEXTS_FILE = os.getenv("CONTEXTS_FILE", "./contexts.json")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user