Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions scripts/check_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import sys

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused sys import

Low Severity

The sys module is imported but never used. The script uses raise SystemExit(main()) which doesn't require sys. This import can be removed.

Fix in Cursor Fix in Web

from pathlib import Path

REQUIRED = ["HOST", "CHAIN_ID", "PRIVATE_KEY", "FUNDER"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checker validates wrong environment variable names

High Severity

The REQUIRED list checks for HOST, CHAIN_ID, PRIVATE_KEY, FUNDER, but the actual example files in this codebase use different env var names: CLOB_API_URL, PK, CLOB_API_KEY, CLOB_SECRET, CLOB_PASS_PHRASE. No code in the repository actually reads the variables being checked, so this preflight checker won't catch the missing variables that cause auth errors.

Fix in Cursor Fix in Web


def load_dotenv(path: Path) -> None:
for line in path.read_text(encoding="utf-8").splitlines():
s = line.strip()
if not s or s.startswith("#") or "=" not in s:
continue
k, v = s.split("=", 1)
os.environ.setdefault(k.strip(), v.strip())

def main() -> int:
dotenv = Path(".env")
if dotenv.exists():
load_dotenv(dotenv)

missing = [k for k in REQUIRED if not os.environ.get(k)]
if missing:
print("Missing required env vars:")
for k in missing:
print(f"- {k}")
return 1

print("Env looks good.")
return 0

if __name__ == "__main__":
raise SystemExit(main())