Problem/Motivation

We use the Key module to store authentication outside of the config, this feature adds support for using it in place of the key in config.

Proposed resolution

If the Key module is installed the api_key textfield in the admin is replace by the Key modules key_select element.

When the api_key is then used in calls to Mailgun\Mailgun:create it is first (if Key module installed) retrieved from the key entity.

Remaining tasks

There are two different methods in the code that are making calls to Mailgun\Mailgun:create, \Drupal\mailgun\MailgunFactory::create and \Drupal\mailgun\MailgunHandler::validateMailgunApiKey. Ideally there should be a single method that is making the create call - I guess logically it should be the MailgunFactory class?

User interface changes

If the Key module is installed the admin form shows Key's select field in place of the textfield.

The same config name is used 'api_key' and the code will fallback to just passing the api_key through if a Key entity cannot be loaded - this will allow the module to be updated for someone with the Key module but not suddenly stop the Mailgun API from connecting.

CommentFileSizeAuthor
#2 3452693_add-key-support.patch3.77 KBAltcom_Neil
Support from Tag1 fosters the development of DrupalTag1 logo

Comments

Altcom_Neil created an issue. See original summary.

Altcom_Neil’s picture