mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
New infrastructure components: - rds_probe: Rust database inspection tool with IAM auth - credential_server.py: REST credential provider server - credential_provider.py: credential resolution chain - ene_rds_fractal_fold.py / ene_rds_wiki_layer.py: RDS-backed ENE layers - import_dumps_to_rds.py / export_linear_from_rds.py: ingestion pipeline - recover_credential_server.sh: deployment script (sanitized) Sanitize hardcoded secrets across codebase: - Strip API keys from recover_credential_server.sh → env var lookups - Replace hardcoded Wolfram appid (HYJE3R3R63) → env var in 5 scripts - Strip fallback key values from config/index.js - Add .claude/ and optimized_basis_v3.bin to .gitignore Ingested 2,685 records into RDS: 2,421 Linear issues + 264 wiki pages
79 lines
2.4 KiB
Python
Executable file
79 lines
2.4 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
"""export_linear_from_rds.py - Exports LINEAR domain records from RDS to JSON.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add infra and scripts folders to import path
|
|
sys.path.append(str(Path(__file__).resolve().parent.parent.parent / "4-Infrastructure" / "infra"))
|
|
sys.path.append(str(Path(__file__).resolve().parent))
|
|
|
|
from import_dumps_to_rds import get_rds_password
|
|
|
|
def main():
|
|
print("[+] Fetching RDS credentials...")
|
|
password = get_rds_password()
|
|
if not password:
|
|
print("[-] Failed to retrieve RDS password or IAM token. Exiting.")
|
|
sys.exit(1)
|
|
|
|
host = os.environ.get("RDS_HOST", "database-1-instance-1.cghu8yqogqwo.us-east-1.rds.amazonaws.com")
|
|
port = int(os.environ.get("RDS_PORT", "5432"))
|
|
user = os.environ.get("RDS_USER", "postgres")
|
|
dbname = os.environ.get("RDS_DB", "postgres")
|
|
|
|
try:
|
|
import psycopg2
|
|
conn = psycopg2.connect(
|
|
host=host,
|
|
port=port,
|
|
user=user,
|
|
password=password,
|
|
dbname=dbname,
|
|
sslmode="require"
|
|
)
|
|
cur = conn.cursor()
|
|
except Exception as e:
|
|
print(f"[-] Database connection failed: {e}")
|
|
sys.exit(1)
|
|
|
|
print("[+] Querying all LINEAR domain packages from RDS...")
|
|
try:
|
|
cur.execute("""
|
|
SELECT pkg, version, domain, tier, archetype, description, tags, source, indexed_utc
|
|
FROM ene.packages
|
|
WHERE domain = 'LINEAR'
|
|
ORDER BY indexed_utc DESC
|
|
""")
|
|
rows = cur.fetchall()
|
|
except Exception as e:
|
|
print(f"[-] Failed to execute query: {e}")
|
|
sys.exit(1)
|
|
|
|
records = []
|
|
for r in rows:
|
|
records.append({
|
|
"pkg": r[0],
|
|
"version": r[1],
|
|
"domain": r[2],
|
|
"tier": r[3],
|
|
"archetype": r[4],
|
|
"description": r[5],
|
|
"tags": r[6],
|
|
"source": r[7],
|
|
"indexed_utc": r[8]
|
|
})
|
|
|
|
out_file = Path(__file__).resolve().parent / "linear_export.json"
|
|
try:
|
|
with open(out_file, "w", encoding="utf-8") as f:
|
|
json.dump(records, f, indent=2, default=str)
|
|
print(f"[+] Successfully exported {len(records)} Linear records to {out_file}")
|
|
except Exception as e:
|
|
print(f"[-] Failed to write JSON output: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|