This commit is contained in:
Manu 2025-02-10 05:12:42 +08:00 committed by GitHub
commit 5e661114af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 2 deletions

View file

@ -104,6 +104,7 @@ If you already have at least version 2.0 installed:
docker run \ docker run \
-p 8000:8000\ -p 8000:8000\
-e APP_URL=https://... \ -e APP_URL=https://... \
-e APP_FORCE_SSL=true \
-e DB_HOST=... \ -e DB_HOST=... \
-e DB_DATABASE=... \ -e DB_DATABASE=... \
-e DB_USERNAME=... \ -e DB_USERNAME=... \

View file

@ -35,7 +35,7 @@ class RouteServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
if (config('app.env') === 'production') { if (config('app.force_ssl')) {
\Illuminate\Support\Facades\URL::forceScheme('https'); \Illuminate\Support\Facades\URL::forceScheme('https');
} }
$this->configureRateLimiting(); $this->configureRateLimiting();

View file

@ -27,6 +27,7 @@ return [
*/ */
'env' => env('APP_ENV', 'production'), 'env' => env('APP_ENV', 'production'),
'force_ssl' => (bool) env('APP_FORCE_SSL', false),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

3
run.sh
View file

@ -13,7 +13,8 @@ DB_HOST=${DB_HOST}
DB_DATABASE=${DB_DATABASE} DB_DATABASE=${DB_DATABASE}
DB_USERNAME=${DB_USERNAME} DB_USERNAME=${DB_USERNAME}
DB_PASSWORD=${DB_PASSWORD} DB_PASSWORD=${DB_PASSWORD}
APP_URL=${APP_URL} APP_URL=${APP_URL:-http://localhost:8000}
APP_FORCE_SSL=${APP_FORCE_SSL:-false}
EOF EOF
php artisan key:generate --no-interaction --force php artisan key:generate --no-interaction --force
fi fi