sanitizing env value before storing into the .env file

This commit is contained in:
Čarodej
2022-05-09 08:23:38 +02:00
parent 4e2ac2b890
commit 0b2d05a899
3 changed files with 4 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ class StoreBroadcastServiceCredentialsController
'PUSHER_APP_CLUSTER' => $request->input('cluster'), 'PUSHER_APP_CLUSTER' => $request->input('cluster'),
'PUSHER_APP_HOST' => '', 'PUSHER_APP_HOST' => '',
'PUSHER_APP_PORT' => '', 'PUSHER_APP_PORT' => '',
'PUSHER_APP_TLS' => true, 'PUSHER_APP_TLS' => 'true',
], ],
'native' => [ 'native' => [
'BROADCAST_DRIVER' => 'pusher', 'BROADCAST_DRIVER' => 'pusher',

View File

@@ -92,7 +92,7 @@ class StoreEnvironmentSettingsController extends Controller
'PUSHER_APP_CLUSTER' => $request->input('broadcast.cluster'), 'PUSHER_APP_CLUSTER' => $request->input('broadcast.cluster'),
'PUSHER_APP_HOST' => '', 'PUSHER_APP_HOST' => '',
'PUSHER_APP_PORT' => '', 'PUSHER_APP_PORT' => '',
'PUSHER_APP_TLS' => true, 'PUSHER_APP_TLS' => 'true',
], ],
'native' => [ 'native' => [
'BROADCAST_DRIVER' => 'pusher', 'BROADCAST_DRIVER' => 'pusher',

View File

@@ -226,9 +226,9 @@ if (! function_exists('setEnvironmentValue')) {
if ($keyPosition) { if ($keyPosition) {
$endOfLinePosition = strpos($str, "\n", $keyPosition); $endOfLinePosition = strpos($str, "\n", $keyPosition);
$oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition); $oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition);
$str = str_replace($oldLine, "{$envKey}={$envValue}", $str); $str = str_replace($oldLine, "{$envKey}=\"{$envValue}\"", $str);
} else { } else {
$str .= "\n$envKey=$envValue"; $str .= "\n$envKey=\"$envValue\"";
} }
} }
} }