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)
|
public function handle(TokenService $tokenService)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'me' => env('APP_URL'),
|
'me' => config('app.url'),
|
||||||
'client_id' => env('APP_URL') . '/notes/new',
|
'client_id' => config('app.url') . '/notes/new',
|
||||||
'scope' => 'post',
|
'scope' => 'post',
|
||||||
];
|
];
|
||||||
$token = $tokenService->getNewToken($data);
|
$token = $tokenService->getNewToken($data);
|
||||||
|
|
|
@ -20,7 +20,7 @@ class AdminController extends Controller
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
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)
|
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]);
|
session(['loggedin' => true]);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class DevTokenMiddleware
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if (config('app.env') !== 'production') {
|
if (config('app.env') !== 'production') {
|
||||||
session(['me' => env('APP_URL')]);
|
session(['me' => config('app.url')]);
|
||||||
if (Storage::exists('dev-token')) {
|
if (Storage::exists('dev-token')) {
|
||||||
session(['token' => Storage::get('dev-token')]);
|
session(['token' => Storage::get('dev-token')]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class SendWebMentions implements ShouldQueue
|
||||||
public function discoverWebmentionEndpoint($url, $guzzle)
|
public function discoverWebmentionEndpoint($url, $guzzle)
|
||||||
{
|
{
|
||||||
//let’s not send webmentions to myself
|
//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;
|
return false;
|
||||||
}
|
}
|
||||||
if (starts_with($url, '/notes/tagged/')) {
|
if (starts_with($url, '/notes/tagged/')) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ class TokenService
|
||||||
->set('scope', $data['scope'])
|
->set('scope', $data['scope'])
|
||||||
->set('date_issued', time())
|
->set('date_issued', time())
|
||||||
->set('nonce', bin2hex(random_bytes(8)))
|
->set('nonce', bin2hex(random_bytes(8)))
|
||||||
->sign($signer, env('APP_KEY'))
|
->sign($signer, config('app.key'))
|
||||||
->getToken();
|
->getToken();
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
|
@ -46,7 +46,7 @@ class TokenService
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($token->verify($signer, env('APP_KEY'))) {
|
if ($token->verify($signer, config('app.key'))) {
|
||||||
//signuture valid
|
//signuture valid
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
25
config/admin.php
Normal file
25
config/admin.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Admin Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The username of the admin account.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'name' => env('ADMIN_NAME'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Admin Password
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The password of the admin account.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'pass' => env('ADMIN_PASS'),
|
||||||
|
|
||||||
|
];
|
|
@ -53,6 +53,17 @@ return [
|
||||||
|
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Long URL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The short URL for the application
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'longurl' => env('APP_LONGURL', 'longurl.local'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Short URL
|
| Application Short URL
|
||||||
|
@ -62,7 +73,18 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'shorturl' => env('APP_SHORTURL', 'http://shorturl.local'),
|
'shorturl' => env('APP_SHORTURL', 'shorturl.local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Display Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The display name for the application, used for example in titles.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'display_name' => env('DISPLAY_NAME', 'Joe Bloggs'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{ env('DISPLAY_NAME') }}</title>
|
<title>{{ config('app.display_name') }}</title>
|
||||||
<atom:link href="{{ config('app.url') }}/feed" rel="self" type="application/rss+xml" />
|
<atom:link href="{{ config('app.url') }}/feed" rel="self" type="application/rss+xml" />
|
||||||
<description>An RSS feed of the blog posts found on {{ config('url.longurl') }}</description>
|
<description>An RSS feed of the blog posts found on {{ config('url.longurl') }}</description>
|
||||||
<link>{{ config('app.url') }}</link>
|
<link>{{ config('app.url') }}</link>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html lang="en-GB">
|
<html lang="en-GB">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>@if (App::environment() == 'local'){!! "[testing] -"!!}@endif @yield('title'){{ env('DISPLAY_NAME') }}</title>
|
<title>@if (App::environment() == 'local'){!! "[testing] -"!!}@endif @yield('title'){{ config('app.display_name') }}</title>
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<link rel="stylesheet" href="/assets/frontend/normalize.css">
|
<link rel="stylesheet" href="/assets/frontend/normalize.css">
|
||||||
<link rel="stylesheet" href="/assets/css/app.css">
|
<link rel="stylesheet" href="/assets/css/app.css">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<body>
|
<body>
|
||||||
<header id="topheader">
|
<header id="topheader">
|
||||||
<a rel="author" href="/">
|
<a rel="author" href="/">
|
||||||
<h1>{{ env('DISPLAY_NAME') }}</h1>
|
<h1>{{ config('app.display_name') }}</h1>
|
||||||
</a>
|
</a>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/blog">Articles</a>
|
<a href="/blog">Articles</a>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
<form action="search" method="get">
|
<form action="search" method="get">
|
||||||
<input type="text" name="terms"><button type="submit">Search</button>
|
<input type="text" name="terms"><button type="submit">Search</button>
|
||||||
</form>
|
</form>
|
||||||
<p>The code for <code>{{ env('APP_LONGURL') }}</code> can be found on <a href="https://github.com/jonnybarnes/jonnybarnes.uk">GitHub</a>.</p>
|
<p>The code for <code>{{ config('app.longurl') }}</code> can be found on <a href="https://github.com/jonnybarnes/jonnybarnes.uk">GitHub</a>.</p>
|
||||||
<p>Built with love: <a href="/colophon">Colophon</a></p>
|
<p>Built with love: <a href="/colophon">Colophon</a></p>
|
||||||
<p><a href="https://indieweb.org"><img src="/assets/img/iwc.png" alt="Indie Web Camp logo" class="iwc-logo"></a></p>
|
<p><a href="https://indieweb.org"><img src="/assets/img/iwc.png" alt="Indie Web Camp logo" class="iwc-logo"></a></p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue