1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 15:33:44 +01: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 \
-p 8000:8000\
-e APP_URL=https://... \
-e APP_FORCE_SSL=true \
-e DB_HOST=... \
-e DB_DATABASE=... \
-e DB_USERNAME=... \

View File

@ -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();

View File

@ -27,6 +27,7 @@ return [
*/
'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_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