Skip to content

Commit bd9b4d7

Browse files
committed
use config() to read env
1 parent 43df3ed commit bd9b4d7

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

app/Console/Commands/Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function __construct()
4949
*/
5050
public function handle()
5151
{
52-
$r = PersonalAccessToken::query()->find(11);
52+
$r = config('nexus.ammds_secret');
5353
// $r = SearchBox::query()->find(4)->ss()->orWhere("mode", 0)->get();
54-
dd($r->abilitiesText);
54+
dd($r);
5555
}
5656

5757
}

app/Repositories/AuthenticateRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function logout($id)
4444

4545
public function nasToolsApprove(string $json)
4646
{
47-
$key = env('NAS_TOOLS_KEY');
47+
$key = config('nexus.nas_tools_key');
4848
$encrypter = new Encrypter($key);
4949
$decrypted = $encrypter->decryptString($json);
5050
$data = json_decode($decrypted, true);
@@ -65,7 +65,7 @@ public function nasToolsApprove(string $json)
6565

6666
public function iyuuApprove($token, $id, $verity)
6767
{
68-
$secret = env('IYUU_SECRET');
68+
$secret = config('nexus.iyuu_secret');
6969
$user = User::query()->findOrFail($id, User::$commonFields);
7070
$user->checkIsNormal();
7171
$encryptedResult = md5($token . $id . sha1($user->passkey) . $secret);
@@ -90,7 +90,7 @@ public function ammdsApprove(Request $request)
9090
$user->checkIsNormal();
9191
$passkeyHash = hash('sha256', $user->passkey);
9292
$dataToSign = sprintf("%s%s%s%s", $user->id, $passkeyHash, $request->timestamp, $request->nonce);
93-
$signatureKey = env('AMMDS_SECRET');
93+
$signatureKey = config('nexus.ammds_secret');
9494
$serverSignature = hash_hmac('sha256', $dataToSign, $signatureKey);
9595
if (!hash_equals($serverSignature, $request->signature)) {
9696
do_log(sprintf(

config/nexus.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,9 @@
5656
'master_key' => nexus_env('MEILISEARCH_MASTER_KEY', ''),
5757
],
5858

59+
'nas_tools_key' => nexus_env('NAS_TOOLS_KEY', ''),
60+
'iyuu_secret' => nexus_env('IYUU_SECRET', ''),
61+
'ammds_secret' => nexus_env('AMMDS_SECRET', ''),
62+
63+
5964
];

0 commit comments

Comments
 (0)