43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
"""Создаёт credentials для n8n (с фиксированными id)."""
|
|
import json
|
|
|
|
PW = open("/root/.pg-superuser-pass").read().strip()
|
|
|
|
creds = [
|
|
{
|
|
"id": "BuryanHeaderAuth1",
|
|
"name": "Header Auth account",
|
|
"type": "httpHeaderAuth",
|
|
"data": {"name": "Authorization",
|
|
"value": "token " + open("/root/.bwork-token").read().strip()},
|
|
},
|
|
{
|
|
"id": "BuryanMonitoring1",
|
|
"name": "Monitoring",
|
|
"type": "postgres",
|
|
"data": {"host": "192.168.1.151", "port": 5432, "database": "buryan_monitoring",
|
|
"user": "postgres", "password": PW, "ssl": "disable"},
|
|
},
|
|
{
|
|
"id": "BuryanPostgres001",
|
|
"name": "Postgres account",
|
|
"type": "postgres",
|
|
"data": {"host": "192.168.1.151", "port": 5432, "database": "buryan_hub",
|
|
"user": "postgres", "password": PW, "ssl": "disable"},
|
|
},
|
|
{
|
|
"id": "BuryanTelegram001",
|
|
"name": "Telegram Bot",
|
|
"type": "telegramApi",
|
|
"data": {"accessToken": "8653974364:AAHHM4adpj1Slwi0qcPDm5IgIt6l7gl2Sxo"},
|
|
},
|
|
]
|
|
|
|
with open("/tmp/creds.json", "w", encoding="utf-8") as f:
|
|
json.dump(creds, f, ensure_ascii=False)
|
|
|
|
with open("/tmp/cred_ids.json", "w", encoding="utf-8") as f:
|
|
json.dump({c["name"]: c["id"] for c in creds}, f)
|
|
|
|
print("готово:", [(c["name"], c["id"]) for c in creds])
|