DNS (Cloudflare)
When Cloudflare is enabled, the panel creates or updates A records for site FQDNs so they point to the server IP. CloudflareClient talks to the Cloudflare API with retry logic; SyncCloudflareDnsJob can sync records for multiple sites.
Usage
- Provisioning — After Nginx is configured,
Provisioner::configureCloudflare()callsupsertARecord(fqdn, serverIp, proxied). Record ID is stored insite.metadata['cloudflare_record_id']. - Cloning —
CloneEngine::configureCloudflare()does the same for the target site FQDN. - Sync job —
SyncCloudflareDnsJobcan be used to reconcile DNS (e.g. after server IP change).
Key file
app/Services/Dns/CloudflareClient.php
isConfigured()— True if token and zone_id are setupsertARecord(name, content, proxied)— Creates or updates A record forname(FQDN) tocontent(IP);proxiedsets orange cloud- Uses retry with exponential backoff for transient API errors
Config
| Env / Key | Purpose |
|---|---|
CLOUDFLARE_TOKEN | API token with Zone:DNS edit |
CLOUDFLARE_ZONE_ID | Zone ID for the domain |
CLOUDFLARE_PROXIED | Whether A records are proxied (orange cloud) |
wphoster.server_ip | Server IP used as A record content |
wphoster.features.cloudflare_dns | Master switch for Cloudflare DNS (default true) |
If Cloudflare is not configured or feature is disabled, provisioning and cloning skip DNS steps without failing.