Paritosh Upadhyay
Hardening V2: CORS Unlocked & Transparency Logs
53058d0
import os
from sqlalchemy import create_engine, text
from sqlalchemy.orm import sessionmaker
# Load configuration from .env
def get_db_url():
env_path = "/Users/paritosh/Desktop/Jarvis/.env"
if not os.path.exists(env_path):
return None
with open(env_path, "r") as f:
for line in f:
if line.startswith("DATABASE_URL="):
return line.split("=")[1].strip().strip('"')
return None
def check_remote_lock():
url = get_db_url()
if not url:
print("Error: DATABASE_URL not found in .env")
return
engine = create_engine(url)
Session = sessionmaker(bind=engine)
session = Session()
try:
result = session.execute(text("SELECT key, value FROM kv_store WHERE key = 'safety_lock'")).fetchone()
if result:
print(f"DATABASE STATUS: {result[0]} = {result[1]}")
else:
print("DATABASE STATUS: safety_lock record NOT FOUND")
except Exception as e:
print(f"Database Error: {e}")
finally:
session.close()
if __name__ == "__main__":
check_remote_lock()