Skip to content

Commit 8ce0863

Browse files
committed
Fix settings service provider to actually work when no migrations have been run.
1 parent 5efee34 commit 8ce0863

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,3 @@ MAIL_FROM=no-reply@example.com
2727
QUEUE_HIGH=high
2828
QUEUE_STANDARD=standard
2929
QUEUE_LOW=low
30-
31-
APP_SERVICE_AUTHOR=undefined@example.com

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
88
* `[beta.3]` — Fixes a bug with the default environment file that was causing an inability to perform a fresh install when running package discovery.
99
* `[beta.3]` — Fixes an edge case caused by the Laravel 5.5 upgrade that would try to perform an in_array check aganist a null value.
1010
* `[beta.3]` — Fixes a bug that would cause an error when attempting to create a new user on the Panel.
11+
* `[beta.3]` — Fixes error handling of the settings service provider when no migrations have been run.
1112

1213
## v0.7.0-beta.3 (Derelict Dermodactylus)
1314
### Fixed

app/Providers/SettingsServiceProvider.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Pterodactyl\Providers;
44

5+
use Illuminate\Contracts\Logging\Log;
6+
use Illuminate\Database\QueryException;
57
use Illuminate\Support\ServiceProvider;
68
use Illuminate\Contracts\Encryption\Encrypter;
79
use Illuminate\Contracts\Encryption\DecryptException;
@@ -60,19 +62,26 @@ class SettingsServiceProvider extends ServiceProvider
6062
*
6163
* @param \Illuminate\Contracts\Config\Repository $config
6264
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
65+
* @param \Illuminate\Contracts\Logging\Log $log
6366
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
6467
*/
65-
public function boot(ConfigRepository $config, Encrypter $encrypter, SettingsRepositoryInterface $settings)
68+
public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings)
6669
{
6770
// Only set the email driver settings from the database if we
6871
// are configured using SMTP as the driver.
6972
if ($config->get('mail.driver') === 'smtp') {
7073
$this->keys = array_merge($this->keys, $this->emailKeys);
7174
}
7275

73-
$values = $settings->all()->mapWithKeys(function ($setting) {
74-
return [$setting->key => $setting->value];
75-
})->toArray();
76+
try {
77+
$values = $settings->all()->mapWithKeys(function ($setting) {
78+
return [$setting->key => $setting->value];
79+
})->toArray();
80+
} catch (QueryException $exception) {
81+
$log->notice('A query exception was encountered while trying to load settings from the database.');
82+
83+
return;
84+
}
7685

7786
foreach ($this->keys as $key) {
7887
$value = array_get($values, 'settings::' . $key, $config->get(str_replace(':', '.', $key)));

0 commit comments

Comments
 (0)