-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConfiguration.php
More file actions
74 lines (68 loc) · 2.97 KB
/
Copy pathConfiguration.php
File metadata and controls
74 lines (68 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
declare(strict_types=1);
namespace CodeRhapsodie\DataflowBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Messenger\MessageBusInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('code_rhapsodie_dataflow');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
->scalarNode('dbal_default_connection')
->defaultValue('default')
->end()
->scalarNode('default_logger')
->defaultValue('logger')
->end()
->arrayNode('messenger_mode')
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')
->defaultFalse()
->end()
->scalarNode('bus')
->defaultValue('messenger.default_bus')
->end()
->end()
->validate()
->ifTrue(static fn ($v): bool => $v['enabled'] && !interface_exists(MessageBusInterface::class))
->thenInvalid('You need "symfony/messenger" in order to use Dataflow messenger mode.')
->end()
->end()
->arrayNode('exceptions_mode')
->addDefaultsIfNotSet()
->children()
->scalarNode('type')
->defaultValue('database')
->end()
->scalarNode('flysystem_service')
->end()
->end()
->validate()
->ifTrue(static fn ($v): bool => $v['type'] === 'file' && !class_exists('\League\Flysystem\Filesystem'))
->thenInvalid('You need "league/flysystem" to use Dataflow file exception mode.')
->end()
->end()
->arrayNode('job_history')
->addDefaultsIfNotSet()
->children()
->integerNode('retention')
->defaultValue(30)
->min(0)
->info('How many days completed and crashed jobs are kept when running the cleanup command.')
->end()
->integerNode('crashed_delay')
->defaultValue(24)
->min(1)
->info('Jobs running for more than this many hours will be set as crashed when running the cleanup command.')
->end()
->end()
->end()
;
return $treeBuilder;
}
}