Skip to content

Commit

Permalink
Load server or cluster keys only when available
Browse files Browse the repository at this point in the history
Don't throw on missing server or cluster config (db config could be complete)
  • Loading branch information
joostfaassen committed Jan 7, 2019
1 parent 6214314 commit b9da9ad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Connector.php
Expand Up @@ -48,18 +48,18 @@ public function getConfig($dsn)

if ($config->getCluster()) {
$clusterKeys = $backend->getKeys('clusters/' . $config->getCluster());
if (!$clusterKeys) {
throw new RuntimeException("No configuration keys found for cluster: " . $config->getCluster());
if ($clusterKeys) {
$this->loadKeys($config, $clusterKeys);
}
$this->loadKeys($config, $clusterKeys);
}

if ($config->getServer()) {
$serverKeys = $backend->getKeys('servers/' . $config->getServer());
if (!$serverKeys) {
throw new RuntimeException("No configuration keys found for server: " . $config->getServer());
if ($serverKeys) {
$this->loadKeys($config, $serverKeys);
} else {
$config->setAddress($config->getServer());
}
$this->loadKeys($config, $serverKeys);
}
return $config;
}
Expand Down

0 comments on commit b9da9ad

Please sign in to comment.