1. <?php
  2. /**
  3. * Reloads API payload configurations for dry-run scenarios.
  4. *
  5. * This script allows reloading API payload configurations without requiring
  6. * a full script restart. Useful for testing changes without deployment.
  7. */
  8. // Define the configuration file path. Can be adjusted.
  9. $config_file = 'api_payload_config.php';
  10. // Check if the configuration file exists
  11. if (file_exists($config_file)) {
  12. // Include the configuration file
  13. require_once $config_file;
  14. // Optionally, perform some validation on the loaded configuration.
  15. // Example:
  16. if (!isset($api_payloads)) {
  17. error_log("Error: API payloads not defined in $config_file");
  18. exit(1);
  19. }
  20. // Output the loaded configuration (for debugging/verification).
  21. header('Content-Type: application/json');
  22. echo json_encode($api_payloads, JSON_PRETTY_PRINT);
  23. } else {
  24. error_log("Error: Configuration file '$config_file' not found.");
  25. exit(1);
  26. }
  27. ?>

Add your comment