From dd69652942a8397edfce4e30c3e12eb6a1ea3ce1 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sun, 4 Dec 2022 16:09:42 -0700 Subject: [PATCH] Fix `No application encryption key has been specified` error while trying to generate said key --- app/Providers/AppServiceProvider.php | 4 ++-- app/Services/Nodes/NodeCreationService.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index d4ffdadbb..6a805bad3 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,12 +2,12 @@ namespace Pterodactyl\Providers; -use View; -use Cache; use Pterodactyl\Models; use Illuminate\Support\Str; use Illuminate\Support\Facades\URL; use Illuminate\Pagination\Paginator; +use Illuminate\Support\Facades\View; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; use Pterodactyl\Extensions\Themes\Theme; diff --git a/app/Services/Nodes/NodeCreationService.php b/app/Services/Nodes/NodeCreationService.php index e4946bc20..b21589c4a 100644 --- a/app/Services/Nodes/NodeCreationService.php +++ b/app/Services/Nodes/NodeCreationService.php @@ -13,7 +13,7 @@ class NodeCreationService /** * NodeCreationService constructor. */ - public function __construct(private Encrypter $encrypter, protected NodeRepositoryInterface $repository) + public function __construct(protected NodeRepositoryInterface $repository) { } @@ -25,7 +25,7 @@ class NodeCreationService public function handle(array $data): Node { $data['uuid'] = Uuid::uuid4()->toString(); - $data['daemon_token'] = $this->encrypter->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)); + $data['daemon_token'] = app(Encrypter::class)->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH)); $data['daemon_token_id'] = Str::random(Node::DAEMON_TOKEN_ID_LENGTH); return $this->repository->create($data, true, true);