Adds the full Next.js app (app/, components/, lib/, scripts/, assets/, docs/, Dockerfile, compose, configs) to version control. Security: - CIPC BizPortal customer-code logins (Login 1 + Login 3) now read CIPC_LOGIN1_CODE / CIPC_LOGIN1_PASSWORD / CIPC_LOGIN3_CODE / CIPC_LOGIN3_PASSWORD from .env.local instead of source. - BizPortal personal login in apply-bizportal route reads BIZPORTAL_ID_NO / BIZPORTAL_PASSWORD. - Added .env.example as the committed template. .gitignore excludes .env*, node_modules, .next, logs, sqlite, Playwright storage_state.json (live CIPC cookies), scratch dirs, client PDFs and debug screenshots.
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
// lib/python.ts
|
|
// Resolve the Python interpreter the workbench should spawn for
|
|
// running scripts in scripts/.
|
|
//
|
|
// The capture + push scripts import third-party modules (requests,
|
|
// playwright, dotenv) that are tracked in scripts/requirements.txt
|
|
// but only installed inside scripts/.venv/. Spawning bare `python`
|
|
// resolves to the system Python (e.g. C:\Users\SJ\AppData\Local\Programs\Python\Python311\python.exe),
|
|
// which does NOT have these modules → ModuleNotFoundError at import.
|
|
//
|
|
// Prefer the venv Python; fall back to `python` (PATH lookup) if
|
|
// the venv doesn't exist for some reason.
|
|
|
|
import { existsSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const SCRIPTS_DIR = path.join(process.cwd(), "scripts");
|
|
|
|
export function getPythonExecutable(): string {
|
|
const venvPythonWin = path.join(SCRIPTS_DIR, ".venv", "Scripts", "python.exe");
|
|
const venvPythonPosix = path.join(SCRIPTS_DIR, ".venv", "bin", "python");
|
|
if (existsSync(venvPythonWin)) return venvPythonWin;
|
|
if (existsSync(venvPythonPosix)) return venvPythonPosix;
|
|
return "python"; // fallback — caller will get a clear error if it doesn't have the deps
|
|
}
|