diff --git a/README.md b/README.md index c6d9cd0..8298752 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ removed. docker run \ -p 8000:8000\ -e APP_URL=https://... \ + -e APP_FORCE_SSL=true \ -e DB_HOST=... \ -e DB_DATABASE=... \ -e DB_USERNAME=... \ diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 3ee2b67..41aea58 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -35,7 +35,7 @@ class RouteServiceProvider extends ServiceProvider */ public function boot() { - if (config('app.env') === 'production') { + if (config('app.force_ssl')) { \Illuminate\Support\Facades\URL::forceScheme('https'); } $this->configureRateLimiting(); diff --git a/config/app.php b/config/app.php index 6a3c4fd..88fa707 100644 --- a/config/app.php +++ b/config/app.php @@ -27,6 +27,7 @@ return [ */ 'env' => env('APP_ENV', 'production'), + 'force_ssl' => (bool) env('APP_FORCE_SSL', false), /* |-------------------------------------------------------------------------- diff --git a/run.sh b/run.sh index f314f75..0550d7c 100755 --- a/run.sh +++ b/run.sh @@ -13,7 +13,8 @@ DB_HOST=${DB_HOST} DB_DATABASE=${DB_DATABASE} DB_USERNAME=${DB_USERNAME} DB_PASSWORD=${DB_PASSWORD} -APP_URL=${APP_URL} +APP_URL=${APP_URL:-http://localhost:8000} +APP_FORCE_SSL=${APP_FORCE_SSL:-false} EOF php artisan key:generate --no-interaction --force fi