Deployer\Bootstrap\BootstrapByConfigFile::initClusters PHP Method

initClusters() public method

public initClusters ( ) : BootstrapByConfigFile
return BootstrapByConfigFile
    public function initClusters()
    {
        foreach ((array) $this->clusterConfig as $name => $config) {
            try {
                $config = new Collection($config);
                $clusterBuilder = $config->has('port') ? $this->clusterBuilders[] = \Deployer\cluster($name, $config['nodes'], $config['port']) : ($this->clusterBuilders[] = \Deployer\cluster($name, $config['nodes']));
                unset($config['local']);
                unset($config['nodes']);
                unset($config['port']);
                $this->executeBuilderMethods($config, $clusterBuilder);
            } catch (\RuntimeException $e) {
                throw new \RuntimeException("Error processing clusters: " . $name);
            }
        }
        return $this;
    }

Usage Example

Beispiel #1
0
/**
 * Load server list file.
 * @param string $file
 */
function serverList($file)
{
    $bootstrap = new Bootstrap\BootstrapByConfigFile();
    $bootstrap->setConfig($file);
    $bootstrap->parseConfig();
    $bootstrap->initServers();
    $bootstrap->initClusters();
}