1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-09-29 03:37:08 +02:00

Add optional env var to force SSL

This commit is contained in:
Manuel Riel 2022-03-23 14:10:27 +00:00
parent 2204970248
commit f9bdc8b124
4 changed files with 5 additions and 2 deletions

View File

@ -78,6 +78,7 @@ removed.
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