Files
BotVPS/scratch/recover_creds.py
T

30 lines
936 B
Python

import asyncio
import os
import sys
# Add root dir to path
sys.path.append("/root/Apps/BotVPS")
from credential_manager import sync_credentials
async def main():
print("Iniciando sincronização de credenciais via Gitea...")
creds = await asyncio.to_thread(sync_credentials)
if creds:
print("Credenciais obtidas com sucesso!")
# Tenta salvar no .env local
with open("/root/Apps/BotVPS/.env.recovered", "w") as f:
for k, v in creds.items():
if isinstance(v, dict):
for subk, subv in v.items():
# Converte para formato ENV comum
f.write(f"{subk.upper()}={subv}\n")
else:
f.write(f"{k.upper()}={v}\n")
print("Salvo em /root/Apps/BotVPS/.env.recovered")
else:
print("Falha ao obter credenciais.")
if __name__ == "__main__":
asyncio.run(main())