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 готов! Ключи подставлены.")