Skip to content

feat(cli): support MARKITDOWN_CU_ENDPOINT and MARKITDOWN_DOCINTEL_ENDPOINT env vars - #2330

Open
Rafli Surya Wijaya (loulanyue) wants to merge 1 commit into
microsoft:mainfrom
loulanyue:fix/2326-endpoint-env-vars
Open

feat(cli): support MARKITDOWN_CU_ENDPOINT and MARKITDOWN_DOCINTEL_ENDPOINT env vars#2330
Rafli Surya Wijaya (loulanyue) wants to merge 1 commit into
microsoft:mainfrom
loulanyue:fix/2326-endpoint-env-vars

Conversation

@loulanyue

Copy link
Copy Markdown

Summary

Adds environment-variable fallbacks for Azure Content Understanding and Document Intelligence endpoints in the CLI:

  • --cu-endpoint falls back to MARKITDOWN_CU_ENDPOINT
  • -e / --endpoint falls back to MARKITDOWN_DOCINTEL_ENDPOINT

Fixes #2326

Rationale

Credentials (AZURE_API_KEY or DefaultAzureCredential) are already ambiently resolved from the environment. Allowing endpoints to be configured via environment variables enables operator-configured deployments and clean tool invocations for automated agents and scripts without needing resource URLs hardcoded in command-line arguments.

Explicit CLI flags (--cu-endpoint, -e / --endpoint) take precedence over environment variables.

Changes

  • packages/markitdown/src/markitdown/__main__.py:
    • Resolved docintel_endpoint = args.endpoint or os.environ.get("MARKITDOWN_DOCINTEL_ENDPOINT").
    • Resolved cu_endpoint = args.cu_endpoint or os.environ.get("MARKITDOWN_CU_ENDPOINT").
    • Updated error messages and argument help text to mention the environment variables.
  • packages/markitdown/tests/test_cli_misc.py:
    • Added unit tests for missing endpoint error messages and environment variable fallbacks.

Verification

  • Ran pytest packages/markitdown/tests/test_cli_misc.py -v:
    test_version PASSED
    test_invalid_flag PASSED
    test_docintel_missing_endpoint_error PASSED
    test_docintel_env_endpoint_fallback PASSED
    test_cu_missing_endpoint_error PASSED
    test_cu_env_endpoint_fallback PASSED
    6 passed in 3.56s
    

…POINT env vars

Allow Azure Content Understanding and Document Intelligence endpoints to be configured via
MARKITDOWN_CU_ENDPOINT and MARKITDOWN_DOCINTEL_ENDPOINT environment variables as fallbacks
when explicit CLI flags are omitted.

Closes microsoft#2326
@loulanyue

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support MARKITDOWN_CU_ENDPOINT / MARKITDOWN_DOCINTEL_ENDPOINT env vars so the endpoint is operator-configured, not caller-supplied

1 participant