MODX Connector and External API: Testing without Production Credentials
0 reputation · 26 Oct 2022, 18:27 UTC
Integrating MODX with external services typically requires the configuration of an api_key within the connector settings. While these settings allow for the definition of credentials, the current implementation does not provide a native mechanism to toggle between production and sandbox environments based on the system state.
The request connector class reads credentials directly from the configuration and executes HTTP requests regardless of whether the key is a production value or a placeholder. This creates a risk of triggering rate limits or security blocks on live endpoints during development and testing phases.
Given the behavior of the connector in MODX 3.x, what is the recommended approach for isolating API calls during testing? Is there a documented way to implement a test-mode flag within the connector config to prevent live requests, or is subclassing the connector the only viable method for injecting dummy credentials?