<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes environment file resolution across all NetFlow pipeline scripts by replacing the CWD-relative default `'../.env'` with an absolute path anchored to each script's own location via `Path(__file__).resolve().parent.parent / '.env'`. This makes scripts runnable from any working directory (repo root or `netflow-db/`) without path resolution failures.
Key changes:
- `common.py`, `depr_ip_db.py`, `ip_time.py`: `load_env_file` now accepts `Optional[str]` (defaulting to `None`), and resolves to `DEFAULT_ENV_PATH` when no path is supplied. The error message now prints the fully-resolved `Path` object for easier debugging.
- `verify_ip_uniqueness.py`: Adds `DEFAULT_ENV_PATH` and wires it as the argparse default for `--env-path`. The error message prints the original `env_path` string rather than the resolved `env_file`, which is a minor inconsistency compared to the other files.
- `docs/pipeline-usage.md`: Updated to document that scripts work correctly from both `netflow-db/` and the repo root.
- The `load_env_file` implementation remains duplicated across three files (pre-existing design), which means future changes to this logic will need to be applied in multiple places.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge; the core fix is correct and well-applied across all affected files.
- The path-resolution logic is sound and consistent. One minor inconsistency exists in `verify_ip_uniqueness.py`'s error message (printing the raw string instead of the resolved path), which is a cosmetic issue worth tidying up. No functional regressions introduced.
- netflow-db/verify_ip_uniqueness.py — minor error-message inconsistency worth tidying up.
<h3>Sequence Diagram</h3>
```mermaid
sequenceDiagram
participant Script
participant load_env_file
participant FileSystem
participant ProcessEnv
Script->>load_env_file: invoke with optional path
alt no path provided
load_env_file->>load_env_file: use DEFAULT_ENV_PATH via __file__
else custom path provided
load_env_file->>load_env_file: apply expanduser to path
end
load_env_file->>FileSystem: check if dotenv file exists
alt file found
FileSystem-->>load_env_file: open handle
load_env_file->>ProcessEnv: populate config entries
load_env_file-->>Script: return successfully
else file not found
load_env_file-->>Script: print resolved path error, exit 1
end
```
<sub>Last reviewed commit: 5f8adff</sub>
> Greptile also left **1 inline comment** on this PR.
<!-- /greptile_comment -->5 files changedLine totals unavailable