init
This commit is contained in:
commit
568b7ec257
9 changed files with 844 additions and 0 deletions
28
setup_config.py
Normal file
28
setup_config.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
load_dotenv()
|
||||
|
||||
template_path = Path("config.template.toml")
|
||||
if not template_path.exists():
|
||||
print(" Файл config.template.toml не найден!")
|
||||
exit(1)
|
||||
|
||||
template = template_path.read_text()
|
||||
|
||||
api_key = os.getenv("ZEROCLAW_API_KEY")
|
||||
tg_token = os.getenv("TELEGRAM_BOT_TOKEN")
|
||||
|
||||
if not api_key or not tg_token:
|
||||
print(" Ошибка: Ключи не найдены в .env файле!")
|
||||
print(f"API_KEY: {'OK' if api_key else 'MISSING'}")
|
||||
print(f"TG_TOKEN: {'OK' if tg_token else 'MISSING'}")
|
||||
exit(1)
|
||||
|
||||
config_ready = template.replace("API_KEY_PLACEHOLDER", api_key)
|
||||
config_ready = config_ready.replace("TELEGRAM_TOKEN_PLACEHOLDER", tg_token)
|
||||
|
||||
Path("config.toml").write_text(config_ready)
|
||||
print("config.toml готов! Ключи подставлены.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue