Skip to content

Use the Gandi API to determine the registered domain.

Boros Gábor requested to merge smarnach/remove-tldextract into master

Created by: smarnach

This PR removes the dependency on the tldextract library and uses information from the Gandi API instead to determine the registered domain name. This is necessary since tldextract depends on the Public Suffix List, so it will return incorrect results for opencraft.hosting, which is now on the Public Suffix List.

The new version requests the list of all domains registered with the Gandi account when first needed, and builds a dictionary of all zone IDs. For setting a DNS record, we now pass in the fully qualified domain name and search the dictionary for a matching suffix. If none is found, we raise an exception, since this means the domain name can't be set using the configured Gandi account.

This PR also introduces a fake implementation of the Gandi API which behaves similar to the actual Gandi API (at least similar enough). It provides stricter tests that can concentrate more on desired outcomes at the same time. (I actually didn't expect this to become as complex as it did.)

This is tested by the integration tests. For manual testing, you can try this on stage, which uses the domain stage.opencraft.hosting, so it's a good test candidate. You only need to start provisioning an instance, since DNS records are set early in the process.

Merge request reports