mirror of
https://github.com/andrey271192/Keenetic_SSH.git
synced 2026-09-20 14:41:58 +00:00
Keenetic SSH: standalone Telegram bot for Keenetic router SSH control
Made-with: Cursor
This commit is contained in:
23
keenetic_ssh/config.py
Normal file
23
keenetic_ssh/config.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import os, json, logging
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
logger = logging.getLogger("keenetic_ssh")
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
DATA_DIR = ROOT / "data"
|
||||
|
||||
TELEGRAM_TOKEN = os.getenv("TELEGRAM_TOKEN", "")
|
||||
TELEGRAM_CHAT_ID = os.getenv("TELEGRAM_CHAT_ID", "")
|
||||
SSH_USER = os.getenv("SSH_USER", "root")
|
||||
SSH_PASS = os.getenv("SSH_PASS", "keenetic")
|
||||
|
||||
ROUTERS_FILE = DATA_DIR / "routers.json"
|
||||
|
||||
def ensure_data():
|
||||
DATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||
if not ROUTERS_FILE.exists():
|
||||
ROUTERS_FILE.write_text(json.dumps({}, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
|
||||
ensure_data()
|
||||
Reference in New Issue
Block a user