Fix settings service provider to actually work when no migrations have been run.
This commit is contained in:
parent
5efee34378
commit
8ce0863559
3 changed files with 14 additions and 6 deletions
|
@ -27,5 +27,3 @@ MAIL_FROM=no-reply@example.com
|
||||||
QUEUE_HIGH=high
|
QUEUE_HIGH=high
|
||||||
QUEUE_STANDARD=standard
|
QUEUE_STANDARD=standard
|
||||||
QUEUE_LOW=low
|
QUEUE_LOW=low
|
||||||
|
|
||||||
APP_SERVICE_AUTHOR=undefined@example.com
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
* `[beta.3]` — Fixes a bug with the default environment file that was causing an inability to perform a fresh install when running package discovery.
|
* `[beta.3]` — Fixes a bug with the default environment file that was causing an inability to perform a fresh install when running package discovery.
|
||||||
* `[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.
|
* `[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.
|
||||||
* `[beta.3]` — Fixes a bug that would cause an error when attempting to create a new user on the Panel.
|
* `[beta.3]` — Fixes a bug that would cause an error when attempting to create a new user on the Panel.
|
||||||
|
* `[beta.3]` — Fixes error handling of the settings service provider when no migrations have been run.
|
||||||
|
|
||||||
## v0.7.0-beta.3 (Derelict Dermodactylus)
|
## v0.7.0-beta.3 (Derelict Dermodactylus)
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Providers;
|
namespace Pterodactyl\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Logging\Log;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Contracts\Encryption\Encrypter;
|
use Illuminate\Contracts\Encryption\Encrypter;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
|
@ -60,9 +62,10 @@ class SettingsServiceProvider extends ServiceProvider
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Contracts\Config\Repository $config
|
* @param \Illuminate\Contracts\Config\Repository $config
|
||||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||||
|
* @param \Illuminate\Contracts\Logging\Log $log
|
||||||
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
|
* @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings
|
||||||
*/
|
*/
|
||||||
public function boot(ConfigRepository $config, Encrypter $encrypter, SettingsRepositoryInterface $settings)
|
public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings)
|
||||||
{
|
{
|
||||||
// Only set the email driver settings from the database if we
|
// Only set the email driver settings from the database if we
|
||||||
// are configured using SMTP as the driver.
|
// are configured using SMTP as the driver.
|
||||||
|
@ -70,9 +73,15 @@ class SettingsServiceProvider extends ServiceProvider
|
||||||
$this->keys = array_merge($this->keys, $this->emailKeys);
|
$this->keys = array_merge($this->keys, $this->emailKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = $settings->all()->mapWithKeys(function ($setting) {
|
try {
|
||||||
return [$setting->key => $setting->value];
|
$values = $settings->all()->mapWithKeys(function ($setting) {
|
||||||
})->toArray();
|
return [$setting->key => $setting->value];
|
||||||
|
})->toArray();
|
||||||
|
} catch (QueryException $exception) {
|
||||||
|
$log->notice('A query exception was encountered while trying to load settings from the database.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->keys as $key) {
|
foreach ($this->keys as $key) {
|
||||||
$value = array_get($values, 'settings::' . $key, $config->get(str_replace(':', '.', $key)));
|
$value = array_get($values, 'settings::' . $key, $config->get(str_replace(':', '.', $key)));
|
||||||
|
|
Loading…
Reference in a new issue