From 6ebd8f8d28b344095c6ce75e53a8d025435044d2 Mon Sep 17 00:00:00 2001 From: Jarvis Prime Date: Wed, 4 Mar 2026 04:41:48 +0000 Subject: [PATCH] =?UTF-8?q?Add=20.env=20file=20loading=20=E2=80=94=20cp=20?= =?UTF-8?q?.env.example=20.env=20and=20edit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docgen.py | 10 ++++++++++ ingest.py | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/docgen.py b/docgen.py index 0f8c419..be710a9 100644 --- a/docgen.py +++ b/docgen.py @@ -4,6 +4,16 @@ import requests import os import concurrent.futures import time +from pathlib import Path + +# Load .env if present +_env_file = Path(__file__).parent / ".env" +if _env_file.exists(): + for line in _env_file.read_text().splitlines(): + line = line.strip() + if line and not line.startswith("#") and "=" in line: + key, _, val = line.partition("=") + os.environ.setdefault(key.strip(), val.strip()) # Backend: "ollama" or "openai" LLM_BACKEND = os.environ.get("LLM_BACKEND", "ollama") diff --git a/ingest.py b/ingest.py index 2e49277..e693df7 100644 --- a/ingest.py +++ b/ingest.py @@ -6,6 +6,15 @@ import time import json from pathlib import Path +# Load .env if present +_env_file = Path(__file__).parent / ".env" +if _env_file.exists(): + for line in _env_file.read_text().splitlines(): + line = line.strip() + if line and not line.startswith("#") and "=" in line: + key, _, val = line.partition("=") + os.environ.setdefault(key.strip(), val.strip()) + from go_parser import parse_go_file, filter_imports, get_repo_module, resolve_import_to_file from docgen import generate_file_doc, generate_repo_doc, generate_docs_batch from db import GraphDB