diff --git a/app/Console/Commands/GenerateToken.php b/app/Console/Commands/GenerateToken.php index dc07e917..9299206c 100644 --- a/app/Console/Commands/GenerateToken.php +++ b/app/Console/Commands/GenerateToken.php @@ -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); diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 7cb338e6..a587c266 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -20,7 +20,7 @@ class AdminController extends Controller */ public function __construct() { - $this->username = env('ADMIN_USER'); + $this->username = config('admin.user'); } /** diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index f752fa21..36be2076 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -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]); diff --git a/app/Http/Middleware/DevTokenMiddleware.php b/app/Http/Middleware/DevTokenMiddleware.php index b1d5e02e..a711142b 100644 --- a/app/Http/Middleware/DevTokenMiddleware.php +++ b/app/Http/Middleware/DevTokenMiddleware.php @@ -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')]); } diff --git a/app/Jobs/SendWebMentions.php b/app/Jobs/SendWebMentions.php index 41bd499b..dd4e2835 100644 --- a/app/Jobs/SendWebMentions.php +++ b/app/Jobs/SendWebMentions.php @@ -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/')) { diff --git a/app/Services/TokenService.php b/app/Services/TokenService.php index 4652d30b..1cabd925 100644 --- a/app/Services/TokenService.php +++ b/app/Services/TokenService.php @@ -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; } diff --git a/config/admin.php b/config/admin.php new file mode 100644 index 00000000..b11b7dd5 --- /dev/null +++ b/config/admin.php @@ -0,0 +1,25 @@ + env('ADMIN_NAME'), + + /* + |-------------------------------------------------------------------------- + | Admin Password + |-------------------------------------------------------------------------- + | + | The password of the admin account. + */ + + 'pass' => env('ADMIN_PASS'), + +]; diff --git a/config/app.php b/config/app.php index ed3364de..57d672d9 100644 --- a/config/app.php +++ b/config/app.php @@ -53,6 +53,17 @@ return [ 'url' => env('APP_URL', 'http://localhost'), + /* + |-------------------------------------------------------------------------- + | Application Long URL + |-------------------------------------------------------------------------- + | + | The short URL for the application + | + */ + + 'longurl' => env('APP_LONGURL', 'longurl.local'), + /* |-------------------------------------------------------------------------- | 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'), /* |-------------------------------------------------------------------------- diff --git a/resources/views/articles/rss.blade.php b/resources/views/articles/rss.blade.php index f6c0253f..792d8989 100644 --- a/resources/views/articles/rss.blade.php +++ b/resources/views/articles/rss.blade.php @@ -1,7 +1,7 @@ - {{ env('DISPLAY_NAME') }} + {{ config('app.display_name') }} An RSS feed of the blog posts found on {{ config('url.longurl') }} {{ config('app.url') }} diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index b5f67954..321a8492 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -2,7 +2,7 @@ - @if (App::environment() == 'local'){!! "[testing] -"!!}@endif @yield('title'){{ env('DISPLAY_NAME') }} + @if (App::environment() == 'local'){!! "[testing] -"!!}@endif @yield('title'){{ config('app.display_name') }} @@ -18,7 +18,7 @@