1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Overwatch\ServiceBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
6
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* This is the class that validates and merges configuration from your app/config files |
10
|
|
|
* |
11
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
12
|
|
|
*/ |
13
|
|
|
class Configuration implements ConfigurationInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritdoc} |
17
|
|
|
*/ |
18
|
|
|
public function getConfigTreeBuilder() |
19
|
|
|
{ |
20
|
|
|
$treeBuilder = new TreeBuilder(); |
21
|
|
|
$rootNode = $treeBuilder->root('overwatch_service'); |
22
|
|
|
|
23
|
|
|
$rootNode |
24
|
|
|
->children() |
25
|
|
|
->arrayNode('to_ping') |
26
|
|
|
->children() |
27
|
|
|
->floatNode('timeout') |
28
|
|
|
->info('Time, in seconds, to wait for a ping response before timing out and marking as unmet') |
29
|
|
|
->defaultValue(2) |
30
|
|
|
->min(0) |
31
|
|
|
->end() |
32
|
|
|
->floatNode('unsatisfactory') |
33
|
|
|
->info('Time, in seconds, to wait for a ping response before marking as unsatisfactory') |
34
|
|
|
->defaultValue(1) |
35
|
|
|
->min(0) |
36
|
|
|
->end() |
37
|
|
|
->end() |
38
|
|
|
->end() |
39
|
|
|
->arrayNode('to_resolve_to') |
40
|
|
|
->children() |
41
|
|
|
->variableNode('record_types') |
42
|
|
|
->info('Array of record types to look at when resolving') |
43
|
|
|
->defaultValue(['A', 'AAAA', 'CNAME']) |
44
|
|
|
->end() |
45
|
|
|
->end() |
46
|
|
|
->end() |
47
|
|
|
->arrayNode('to_respond_http') |
48
|
|
|
->children() |
49
|
|
|
->variableNode('allowable_codes') |
50
|
|
|
->info('Array of acceptable HTTP codes') |
51
|
|
|
->defaultValue([200, 201, 204, 206, 304]) |
52
|
|
|
->end() |
53
|
|
|
->variableNode('unsatisfactory_codes') |
54
|
|
|
->info('Array of unsatisfactory HTTP codes') |
55
|
|
|
->defaultValue([301, 302, 307, 308]) |
56
|
|
|
->end() |
57
|
|
|
->floatNode('timeout') |
58
|
|
|
->info('Time, in seconds, to wait for a HTTP response before timing out. Use 0 for no timeout.') |
59
|
|
|
->defaultValue(10) |
60
|
|
|
->min(0) |
61
|
|
|
->end() |
62
|
|
|
->end() |
63
|
|
|
->end() |
64
|
|
|
->arrayNode('to_respond_with_mime_type') |
65
|
|
|
->children() |
66
|
|
|
->booleanNode('allow_errors') |
67
|
|
|
->info('If true, HTTP errors will be ignored and the MIME type of the response will still be checked.') |
68
|
|
|
->defaultFalse() |
69
|
|
|
->end() |
70
|
|
|
->floatNode('timeout') |
71
|
|
|
->info('Time, in seconds, to wait for a HTTP response before timing out. Use 0 for no timeout.') |
72
|
|
|
->defaultValue(10) |
73
|
|
|
->min(0) |
74
|
|
|
->end() |
75
|
|
|
->end() |
76
|
|
|
->end() |
77
|
|
|
->arrayNode('to_contain_text') |
78
|
|
|
->children() |
79
|
|
|
->booleanNode('allow_errors') |
80
|
|
|
->info('If true, HTTP errors will be ignored and the response will still be checked.') |
81
|
|
|
->defaultFalse() |
82
|
|
|
->end() |
83
|
|
|
->variableNode('crawlable_types') |
84
|
|
|
->info('Array of MIME types that will be parsed by the Symfony DomCrawler') |
85
|
|
|
->defaultValue(['text/html', 'text/xml', 'application/xml', 'text/rss+xml', 'application/rss+xml', 'application/rdf+xml', 'application/atom+xml']) |
86
|
|
|
->end() |
87
|
|
|
->floatNode('timeout') |
88
|
|
|
->info('Time, in seconds, to wait for a HTTP response before timing out. Use 0 for no timeout.') |
89
|
|
|
->defaultValue(10) |
90
|
|
|
->min(0) |
91
|
|
|
->end() |
92
|
|
|
->end() |
93
|
|
|
->end() |
94
|
|
|
->arrayNode('email_reporter') |
95
|
|
|
->children() |
96
|
|
|
->booleanNode('enabled') |
97
|
|
|
->info('Send email reports when the results of a test change') |
98
|
|
|
->defaultTrue() |
99
|
|
|
->end() |
100
|
|
|
->variableNode('report_from') |
101
|
|
|
->info('E-mail address to send reports from') |
102
|
|
|
->defaultValue('[email protected]') |
103
|
|
|
->end() |
104
|
|
|
->end() |
105
|
|
|
->end() |
106
|
|
|
->arrayNode('sms_reporter') |
107
|
|
|
->children() |
108
|
|
|
->booleanNode('enabled') |
109
|
|
|
->info('Send sms reports when the results of a test change') |
110
|
|
|
->defaultFalse() |
111
|
|
|
->end() |
112
|
|
|
->variableNode('twilio_account_sid') |
113
|
|
|
->info('Twilio AccountSid from https://www.twilio.com/user/account') |
114
|
|
|
->defaultValue('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') |
115
|
|
|
->end() |
116
|
|
|
->variableNode('twilio_auth_token') |
117
|
|
|
->info('Twilio AuthToken from https://www.twilio.com/user/account') |
118
|
|
|
->defaultValue('YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY') |
119
|
|
|
->end() |
120
|
|
|
->variableNode('twilio_from_number') |
121
|
|
|
->info('Twilio number the account specified has been assigned to send notifications from') |
122
|
|
|
->defaultValue('+CCXXXXXXXXXX') |
123
|
|
|
->end() |
124
|
|
|
->end() |
125
|
|
|
->end() |
126
|
|
|
->end() |
127
|
|
|
; |
128
|
|
|
|
129
|
|
|
return $treeBuilder; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|