Skip to content

Commit 3f63d3e

Browse files
authored
Merge pull request jeremykenedy#153 from rubendahl/config-settings-preferred-over-env
Prefer to use config settings in application code over `env()` calls due to Laravel configuration caching.
2 parents 5b903df + f916cc6 commit 3f63d3e

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

app/Http/Controllers/UsersManagementController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct()
3030
*/
3131
public function index()
3232
{
33-
$users = User::paginate(env('USER_LIST_PAGINATION_SIZE'));
33+
$users = User::paginate(config('settings.userListPaginationSize'));
3434
$roles = Role::all();
3535

3636
return View('usersmanagement.show-users', compact('users', 'roles'));

app/Traits/CaptchaTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function captchaCheck()
1111
{
1212
$response = Input::get('g-recaptcha-response');
1313
$remoteip = $_SERVER['REMOTE_ADDR'];
14-
$secret = env('RE_CAP_SECRET');
14+
$secret = config('settings.reCaptchSecret');
1515

1616
$recaptcha = new ReCaptcha($secret);
1717
$resp = $recaptcha->verify($response, $remoteip);

config/settings.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
*/
3333
'restoreUserCutoff' => env('USER_RESTORE_CUTOFF_DAYS', 31),
3434

35+
/*
36+
* User list pagination size
37+
*/
38+
'userListPaginationSize' => env('USER_LIST_PAGINATION_SIZE', 50),
39+
3540
/*
3641
* User restore encryption key
3742
*/
@@ -42,9 +47,24 @@
4247
*/
4348
'reCaptchStatus' => env('ENABLE_RECAPTCHA', false),
4449

50+
/*
51+
* ReCaptcha Site Key
52+
*/
53+
'reCaptchSite' => env('RE_CAP_SITE', 'YOURGOOGLECAPTCHAsitekeyHERE'),
54+
55+
/*
56+
* ReCaptcha Secret
57+
*/
58+
'reCaptchSecret' => env('RE_CAP_SECRET', 'YOURGOOGLECAPTCHAsecretHERE'),
59+
4560
/*
4661
* Google Maps API V3 Status
4762
*/
4863
'googleMapsAPIStatus' => env('GOOGLEMAPS_API_STATUS', false),
4964

65+
/*
66+
* Google Maps API Key
67+
*/
68+
'googleMapsAPIKey' => env('GOOGLEMAPS_API_KEY', 'YOURGOOGLEMAPSkeyHERE'),
69+
5070
];

resources/views/auth/register.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
@if(config('settings.reCaptchStatus'))
8383
<div class="form-group">
8484
<div class="col-sm-6 col-sm-offset-4">
85-
<div class="g-recaptcha" data-sitekey="{{ env('RE_CAP_SITE') }}"></div>
85+
<div class="g-recaptcha" data-sitekey="{{ config('settings.reCaptchSite') }}"></div>
8686
</div>
8787
</div>
8888
@endif

resources/views/layouts/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<script src="{{ mix('/js/app.js') }}"></script>
7373

7474
@if(config('settings.googleMapsAPIStatus'))
75-
{!! HTML::script('//maps.googleapis.com/maps/api/js?key='.env("GOOGLEMAPS_API_KEY").'&libraries=places&dummy=.js', array('type' => 'text/javascript')) !!}
75+
{!! HTML::script('//maps.googleapis.com/maps/api/js?key='.config("settings.googleMapsAPIKey").'&libraries=places&dummy=.js', array('type' => 'text/javascript')) !!}
7676
@endif
7777

7878
@yield('footer_scripts')

0 commit comments

Comments
 (0)