Skip to content

Commit

Permalink
Fix start errors without database connection (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden authored Mar 18, 2024
1 parent f75bca8 commit 5783bbe
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Framework\App\Helper\Context;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\App\State;
use Magento\Framework\DB\Adapter\TableNotFoundException;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
Expand Down Expand Up @@ -192,12 +193,24 @@ public function getGeneralConfig($code, $storeId = null)
*/
public function collectModuleConfig(): array
{
$this->config['enabled'] = $this->scopeConfig->getValue('sentry/environment/enabled')
?? $this->deploymentConfig->get('sentry') !== null;
if (isset($this->config['enabled'])) {
return $this->config;
}

try {
$this->config['enabled'] = $this->scopeConfig->getValue('sentry/environment/enabled')
?? $this->deploymentConfig->get('sentry') !== null;
} catch (TableNotFoundException $e) {
$this->config['enabled'] = null;
}

foreach ($this->configKeys as $value) {
$this->config[$value] = $this->scopeConfig->getValue('sentry/environment/'.$value)
?? $this->deploymentConfig->get('sentry/'.$value);
try {
$this->config[$value] = $this->scopeConfig->getValue('sentry/environment/'.$value)
?? $this->deploymentConfig->get('sentry/'.$value);
} catch (TableNotFoundException $e) {
$this->config[$value] = null;
}
}

return $this->config;
Expand Down

0 comments on commit 5783bbe

Please sign in to comment.