processmaker icon indicating copy to clipboard operation
processmaker copied to clipboard

FOUR-27111 | Implement Backend Logic to Call API → Submit Document for Extraction

Open mcraeteisha opened this issue 2 months ago • 1 comments

Summary

This PR adds configuration support for Smart Extract API variables, making them available as environment variables to scripts running in the Script Microservice Runner.

Solution

1. Configuration (config/app.php)

  • Added smart_extract_api_host configuration option with default value 'extract-api.processmaker.net'
  • Added smart_extract_api_token configuration option (empty string by default)

2. Script Runner Environment Variables (ProcessMaker/ScriptRunners/ScriptMicroserviceRunner.php)

  • Added SMART_EXTRACT_API_HOST to the environment variables passed to scripts
  • Added SMART_EXTRACT_PM_API_TOKEN to the environment variables passed to scripts
  • These variables are injected into the script execution environment alongside existing variables like API_TOKEN, API_HOST, etc.

How To Test

  • Verify that scripts can access SMART_EXTRACT_API_HOST and SMART_EXTRACT_PM_API_TOKEN as environment variables

Code Review Checklist

  • [ ] I have pulled this code locally and tested it on my instance, along with any associated packages.
  • [ ] This code adheres to ProcessMaker Coding Guidelines.
  • [ ] This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • [ ] This solution fixes the bug reported in the original ticket.
  • [ ] This solution does not alter the expected output of a component in a way that would break existing Processes.
  • [ ] This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • [ ] This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • [ ] This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • [ ] This ticket conforms to the PRD associated with this part of ProcessMaker.

[!NOTE] Adds Smart Extract API host/token config and injects them as SMART_EXTRACT_API_HOST and SMART_EXTRACT_PM_API_TOKEN env vars to scripts.

  • Config:
    • Add app.smart_extract_api_host (default extract-api.processmaker.net).
    • Add app.smart_extract_api_token (default empty).
  • Script Runner (ProcessMaker/ScriptRunners/ScriptMicroserviceRunner.php):
    • Include SMART_EXTRACT_API_HOST and SMART_EXTRACT_PM_API_TOKEN in script environment variables alongside existing API_* vars.

Written by Cursor Bugbot for commit 34840d31c56f6919212be4786bbf68e0c5d3f792. This will update automatically on new commits. Configure here.

mcraeteisha avatar Nov 25 '25 22:11 mcraeteisha

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube