1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Azine\MailgunWebhooksBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
6
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
7
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This is the class that validates and merges configuration from your app/config files |
11
|
|
|
* |
12
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
13
|
|
|
*/ |
14
|
|
|
class Configuration implements ConfigurationInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* {@inheritDoc} |
18
|
3 |
|
*/ |
19
|
|
|
public function getConfigTreeBuilder() |
20
|
3 |
|
{ |
21
|
3 |
|
$treeBuilder = new TreeBuilder(); |
22
|
|
|
$rootNode = $treeBuilder->root(AzineMailgunWebhooksExtension::PREFIX); |
23
|
|
|
|
24
|
3 |
|
$rootNode |
25
|
3 |
|
->children() |
26
|
3 |
|
->scalarNode(AzineMailgunWebhooksExtension::API_KEY)->isRequired()->cannotBeEmpty()->info("Your api-key for mailgun => see https://mailgun.com/cp")->end() |
27
|
3 |
|
->scalarNode(AzineMailgunWebhooksExtension::PUBLIC_API_KEY)->defaultValue("")->info("Your public-api-key for mailgun => see https://mailgun.com/cp")->end() |
28
|
3 |
|
->scalarNode(AzineMailgunWebhooksExtension::EMAIL_DOMAIN)->defaultValue("")->info("Your email domain configured on Mailgun")->end() |
29
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::SEND_SPAM_ALERTS)->defaultFalse()->info("Whether to send email notifications after receiving spam complaints")->end() |
30
|
3 |
|
->scalarNode(AzineMailgunWebhooksExtension::SEND_SPAM_ALERTS_INTERVAL)->defaultFalse()->info("Interval in minutes between sending of email notifications after receiving spam complaints")->end() |
31
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::TICKET_ID)->defaultValue("")->info("Mailgun helpdesk ticket ID to request new IP address in case of spam complains")->end() |
32
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::TICKET_SUBJECT)->defaultValue("IP on spam-list, please fix.")->info("Mailgun HelpDesk ticket subject")->end() |
33
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::TICKET_MESSAGE)->defaultValue("It looks like my ip is on a spam-list. Please, assign a clean IP to my domain.")->info("Mailgun HelpDesk ticket subject")->end() |
34
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::ADMIN_USER_EMAIL)->defaultValue("")->info("Admin E-Mail to send notification about spam complaints")->end() |
35
|
|
|
->end(); |
36
|
|
|
|
37
|
|
|
$this->addSpamAlertsSection($rootNode); |
38
|
|
|
|
39
|
|
|
return $treeBuilder; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param ArrayNodeDefinition $node |
44
|
|
|
*/ |
45
|
|
|
private function addSpamAlertsSection(ArrayNodeDefinition $node) |
46
|
|
|
{ |
47
|
|
|
$node |
48
|
|
|
->children() |
49
|
|
|
->arrayNode('spam_alerts') |
50
|
|
|
->addDefaultsIfNotSet() |
51
|
|
|
->canBeUnset() |
52
|
|
|
->children() |
53
|
|
|
->booleanNode(AzineMailgunWebhooksExtension::SEND_ENABLED)->defaultFalse()->info("Whether to send email notifications after receiving spam complaints")->end() |
54
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::SEND_INTERVAL)->defaultValue('60')->info("Interval in minutes between sending of email notifications after receiving spam complaints")->end() |
55
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::TICKET_ID)->defaultValue("")->info("Mailgun helpdesk ticket ID to request new IP address in case of spam complains")->end() |
56
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::TICKET_SUBJECT)->defaultValue("IP on spam-list, please fix.")->info("Mailgun HelpDesk ticket subject")->end() |
57
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::TICKET_MESSAGE)->defaultValue("It looks like my ip is on a spam-list. Please, assign a clean IP to my domain.")->info("Mailgun HelpDesk ticket subject")->end() |
58
|
|
|
->scalarNode(AzineMailgunWebhooksExtension::ALERTS_RECIPIENT_EMAIL)->defaultValue("")->info("Admin E-Mail to send notification about spam complaints")->end() |
59
|
|
|
->end(); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|