Updated file structure to Laravel 11, allowed reverse proxies.

This commit is contained in:
Exynox 2024-12-07 20:17:02 +02:00
parent d4138350a9
commit a1d47b633e
5 changed files with 656 additions and 789 deletions

View File

@ -1,55 +1,31 @@
<?php <?php
/* use Illuminate\Foundation\Application;
|-------------------------------------------------------------------------- use Illuminate\Foundation\Configuration\Exceptions;
| Create The Application use Illuminate\Foundation\Configuration\Middleware;
|-------------------------------------------------------------------------- use Symfony\Component\HttpFoundation\Request;
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application( return Application::configure(basePath: dirname(__DIR__))
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) ->withRouting(
); web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
/* health: '/up',
|-------------------------------------------------------------------------- )
| Bind Important Interfaces ->withMiddleware(function (Middleware $middleware) {
|-------------------------------------------------------------------------- $middleware->trustProxies(at: [
| '10.0.0.0/8',
| Next, we need to bind some important interfaces into the container so '172.16.0.0/12',
| we will be able to resolve them when needed. The kernels serve the '192.168.0.0/16',
| incoming requests to this application from both the web and CLI. ]);
| })
*/ ->withMiddleware(function (Middleware $middleware) {
$middleware->trustProxies(headers: Request::HEADER_X_FORWARDED_FOR |
$app->singleton( Request::HEADER_X_FORWARDED_HOST |
Illuminate\Contracts\Http\Kernel::class, Request::HEADER_X_FORWARDED_PORT |
App\Http\Kernel::class Request::HEADER_X_FORWARDED_PROTO |
); Request::HEADER_X_FORWARDED_AWS_ELB
);
$app->singleton( })
Illuminate\Contracts\Console\Kernel::class, ->withExceptions(function (Exceptions $exceptions) {
App\Console\Kernel::class //
); })->create();
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

10
bootstrap/providers.php Normal file
View File

@ -0,0 +1,10 @@
<?php
return [
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\ViewServiceProvider::class,
];

View File

@ -7,7 +7,7 @@
"require": { "require": {
"php": "^8.2", "php": "^8.2",
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^11.0", "laravel/framework": "^11.31",
"laravel/sanctum": "^4.0", "laravel/sanctum": "^4.0",
"laravel/tinker": "^2.8", "laravel/tinker": "^2.8",
"ext-gd": "*", "ext-gd": "*",

1244
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,5 @@
<?php <?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [ return [
/* /*
@ -10,9 +7,9 @@
| Application Name | Application Name
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This value is the name of your application. This value is used when the | This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or | framework needs to place the application's name in a notification or
| any other location as required by the application or its packages. | other UI elements where an application name needs to be displayed.
| |
*/ */
@ -51,26 +48,24 @@
| |
| This URL is used by the console to properly generate URLs when using | This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of | the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks. | the application so that it's available within Artisan commands.
| |
*/ */
'url' => env('APP_URL', 'http://localhost'), 'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Timezone | Application Timezone
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify the default timezone for your application, which | Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone | will be used by the PHP date and date-time functions. The timezone
| ahead and set this to a sensible default for you out of the box. | is set to "UTC" by default as it is suitable for most use cases.
| |
*/ */
'timezone' => 'UTC', 'timezone' => env('APP_TIMEZONE', 'UTC'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -78,53 +73,37 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The application locale determines the default locale that will be used | The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value | by Laravel's translation / localization methods. This option can be
| to any of the locales which will be supported by the application. | set to any locale for which you plan to have translation strings.
| |
*/ */
'locale' => 'en', 'locale' => env('APP_LOCALE', 'en'),
/* 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en', 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Encryption Key | Encryption Key
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This key is used by the Illuminate encrypter service and should be set | This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string, otherwise these encrypted strings | to a random, 32 character string to ensure that all encrypted values
| will not be safe. Please do this before deploying an application! | are secure. You should do this prior to deploying the application.
| |
*/ */
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'), 'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC', 'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -140,50 +119,8 @@
*/ */
'maintenance' => [ 'maintenance' => [
'driver' => 'file', 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
// 'store' => 'redis', 'store' => env('APP_MAINTENANCE_STORE', 'database'),
], ],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\ViewServiceProvider::class,
])->toArray(),
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
])->toArray(),
]; ];