Convert all env() calls to config() calls
This commit is contained in:
parent
e032cd5861
commit
b4df7a1bbb
10 changed files with 61 additions and 14 deletions
|
@ -47,8 +47,8 @@ class GenerateToken extends Command
|
|||
public function handle(TokenService $tokenService)
|
||||
{
|
||||
$data = [
|
||||
'me' => env('APP_URL'),
|
||||
'client_id' => env('APP_URL') . '/notes/new',
|
||||
'me' => config('app.url'),
|
||||
'client_id' => config('app.url') . '/notes/new',
|
||||
'scope' => 'post',
|
||||
];
|
||||
$token = $tokenService->getNewToken($data);
|
||||
|
|
|
@ -20,7 +20,7 @@ class AdminController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->username = env('ADMIN_USER');
|
||||
$this->username = config('admin.user');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,9 +15,9 @@ class AuthController extends Controller
|
|||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
if ($request->input('username') === env('ADMIN_USER')
|
||||
if ($request->input('username') === config('admin.user')
|
||||
&&
|
||||
$request->input('password') === env('ADMIN_PASS')
|
||||
$request->input('password') === config('admin.pass')
|
||||
) {
|
||||
session(['loggedin' => true]);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class DevTokenMiddleware
|
|||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (config('app.env') !== 'production') {
|
||||
session(['me' => env('APP_URL')]);
|
||||
session(['me' => config('app.url')]);
|
||||
if (Storage::exists('dev-token')) {
|
||||
session(['token' => Storage::get('dev-token')]);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class SendWebMentions implements ShouldQueue
|
|||
public function discoverWebmentionEndpoint($url, $guzzle)
|
||||
{
|
||||
//let’s not send webmentions to myself
|
||||
if (parse_url($url, PHP_URL_HOST) == env('LONG_URL', 'localhost')) {
|
||||
if (parse_url($url, PHP_URL_HOST) == config('app.longurl')) {
|
||||
return false;
|
||||
}
|
||||
if (starts_with($url, '/notes/tagged/')) {
|
||||
|
|
|
@ -24,7 +24,7 @@ class TokenService
|
|||
->set('scope', $data['scope'])
|
||||
->set('date_issued', time())
|
||||
->set('nonce', bin2hex(random_bytes(8)))
|
||||
->sign($signer, env('APP_KEY'))
|
||||
->sign($signer, config('app.key'))
|
||||
->getToken();
|
||||
|
||||
return $token;
|
||||
|
@ -46,7 +46,7 @@ class TokenService
|
|||
} catch (RuntimeException $e) {
|
||||
return;
|
||||
}
|
||||
if ($token->verify($signer, env('APP_KEY'))) {
|
||||
if ($token->verify($signer, config('app.key'))) {
|
||||
//signuture valid
|
||||
return $token;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue