mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-11 06:30:56 +00:00
- Add Telegram bot (@GenX_FX_bot) for cloud deployment automation - Add web dashboard with deployment status and quick links - Add Exness terminal deployment script - Add dashboard deployment script (Fly.io, Render, GitHub Pages) - Add personal vault for secure credential storage - Update deploy_cloud.py with Fly.io deployment automation - Add GitHub Pages workflow for dashboard auto-deployment - Add bot setup documentation and deployment guides
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Load credentials from personal vault (config/vault.json)
|
|
Used by Python scripts to securely access credentials
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
VAULT_PATH = REPO_ROOT / "config" / "vault.json"
|
|
|
|
|
|
def load_vault():
|
|
"""Load credentials from vault.json"""
|
|
if not VAULT_PATH.exists():
|
|
print(f"⚠️ Vault file not found at: {VAULT_PATH}")
|
|
return None
|
|
|
|
try:
|
|
with open(VAULT_PATH, 'r') as f:
|
|
vault = json.load(f)
|
|
return vault
|
|
except json.JSONDecodeError as e:
|
|
print(f"❌ Error parsing vault.json: {e}")
|
|
return None
|
|
except Exception as e:
|
|
print(f"❌ Error loading vault: {e}")
|
|
return None
|
|
|
|
|
|
def get_telegram_token():
|
|
"""Get Telegram bot token from vault"""
|
|
vault = load_vault()
|
|
if vault and 'telegram_bot' in vault:
|
|
return vault['telegram_bot'].get('token')
|
|
return None
|
|
|
|
|
|
def get_telegram_allowed_users():
|
|
"""Get allowed Telegram user IDs from vault"""
|
|
vault = load_vault()
|
|
if vault and 'telegram_bot' in vault:
|
|
return vault['telegram_bot'].get('allowed_user_ids', [])
|
|
return []
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# Set environment variables when run directly
|
|
token = get_telegram_token()
|
|
if token:
|
|
os.environ['TELEGRAM_BOT_TOKEN'] = token
|
|
print("✅ Telegram bot token loaded from vault")
|
|
|
|
allowed_users = get_telegram_allowed_users()
|
|
if allowed_users:
|
|
os.environ['TELEGRAM_ALLOWED_USER_IDS'] = ','.join(map(str, allowed_users))
|