feat: Add auth bypass feature for local dev
This commit is contained in:
parent
5a25b0ba21
commit
f3c97443a6
2 changed files with 13 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ namespace App\Providers;
|
|||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
|
|
@ -17,6 +18,12 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (
|
||||
in_array(config('app.env'), ['local', 'testing']) && config('app.bypassldap') && !app()->runningInConsole()
|
||||
) {
|
||||
Auth::loginUsingId(1);
|
||||
}
|
||||
|
||||
// !!! Fuc**** Lab LDC exception OMG !!!
|
||||
if (!in_array(config('app.env'), ['local', 'testing'])) {
|
||||
URL::forceRootUrl(config('app.url'));
|
||||
|
|
@ -26,11 +33,10 @@ class AppServiceProvider extends ServiceProvider
|
|||
return $url->current();
|
||||
});
|
||||
}
|
||||
// * LOCAL HTTPS FIX
|
||||
if (!in_array(config('app.env'), ['local', 'testing'])) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
// * HA PROXY FIX
|
||||
// * Force HTTPS
|
||||
URL::forceScheme('https');
|
||||
|
||||
// * REVERSE PROXY FIX
|
||||
App::singleton('clientIp', function () {
|
||||
if (config('app.env') == 'local') {
|
||||
return request()->getClientIp();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ use Illuminate\Support\Facades\Facade;
|
|||
|
||||
return [
|
||||
|
||||
'bypassldap' => env('BYPASS_LDAP', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue