Allow multiple servers in configuration
This commit is contained in:
parent
193ca3848b
commit
58eaf6b03e
|
@ -45,10 +45,41 @@ class Configuration
|
||||||
->useAttributeAsKey('id')
|
->useAttributeAsKey('id')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
->performNoDeepMerging()
|
->performNoDeepMerging()
|
||||||
|
->beforeNormalization()
|
||||||
|
->ifTrue(function($v) { return isset($v['host']) && isset($v['port']); })
|
||||||
|
->then(function($v) {
|
||||||
|
return array(
|
||||||
|
'servers' => array(
|
||||||
|
'default' => array(
|
||||||
|
'host' => $v['host'],
|
||||||
|
'port' => $v['port'],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
})
|
||||||
|
->end()
|
||||||
|
->beforeNormalization()
|
||||||
|
->ifTrue(function($v) { return isset($v['url']); })
|
||||||
|
->then(function($v) {
|
||||||
|
return array(
|
||||||
|
'servers' => array(
|
||||||
|
'default' => array(
|
||||||
|
'url' => $v['url'],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
})
|
||||||
|
->end()
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('url')->end()
|
->arrayNode('servers')
|
||||||
->scalarNode('host')->end()
|
->prototype('array')
|
||||||
->scalarNode('port')->end()
|
->children()
|
||||||
|
->scalarNode('url')->end()
|
||||||
|
->scalarNode('host')->end()
|
||||||
|
->scalarNode('port')->end()
|
||||||
|
->end()
|
||||||
|
->end()
|
||||||
|
->end()
|
||||||
->scalarNode('timeout')->end()
|
->scalarNode('timeout')->end()
|
||||||
->scalarNode('headers')->end()
|
->scalarNode('headers')->end()
|
||||||
->end()
|
->end()
|
||||||
|
|
Loading…
Reference in a new issue