Skip to content

Allow GPDF_API_URL to be overridden via wp-config.php#1666

Merged
jakejackson1 merged 1 commit into
developmentfrom
license-api-url-override
Jun 9, 2026
Merged

Allow GPDF_API_URL to be overridden via wp-config.php#1666
jakejackson1 merged 1 commit into
developmentfrom
license-api-url-override

Conversation

@jakejackson1

Copy link
Copy Markdown
Member

Summary

Wraps the GPDF_API_URL define in an if ( ! defined() ) guard so a site can override the licensing/update endpoint from wp-config.php. This lets a staging site point at the upcoming Cloudflare Worker licensing proxy without editing plugin code. Also adds a comment documenting why the bulk get_version params must stay numerically indexed (the API keys its response array by the same keys it receives, so numeric indices keep the response a JSON array that the response handlers decode via is_array()).

Try it

Add to wp-config.php:

define( 'GPDF_API_URL', 'https://staging-endpoint.example.com' );

Licensing and update checks now hit that endpoint; with no override they continue to use https://api.gravitypdf.com.

Test plan

  • With no override defined, licensing and update checks work against https://api.gravitypdf.com as before
  • With the constant defined in wp-config.php, requests go to the override endpoint
More info

Part of repointing the licensing/update API at a Cloudflare Worker proxy. The proxy-side changes (status passthrough, content-type handling, rate-limit bypass, tests) live in the gravitypdf-update-server repo. The guard is the standard WordPress constant-override idiom and is a no-op when the constant isn't pre-defined.

🤖 Generated with Claude Code

Guard the GPDF_API_URL define so a site can point licensing/update requests at
a staging endpoint (e.g. the upcoming Cloudflare Worker proxy) from
wp-config.php without editing plugin code. Also document why the bulk
get_version params must stay numerically indexed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jakejackson1 jakejackson1 merged commit 50dcd2b into development Jun 9, 2026
6 of 10 checks passed
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.

1 participant