Try to automatically quote strings.
Incredibly basic checking, only checks if there is a space and no quote character. Also includes comments on edited lines to avoid users changing things that get overwritten again later.
This commit is contained in:
parent
30b4934013
commit
e4c341795d
3 changed files with 11 additions and 2 deletions
|
@ -147,7 +147,10 @@ class UpdateEmailSettings extends Command
|
|||
|
||||
$this->line('Writing new email environment configuration to file.');
|
||||
foreach ($variables as $key => $value) {
|
||||
$newValue = $key . '=' . $value;
|
||||
if (str_contains($value, ' ') && ! str_contains($value, '"')) {
|
||||
$value = '"' . $value . '"';
|
||||
}
|
||||
$newValue = $key . '=' . $value . ' # DO NOT EDIT! set using pterodactyl:mail';
|
||||
|
||||
if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) {
|
||||
$envContents = $envContents . "\n" . $newValue;
|
||||
|
|
|
@ -186,7 +186,10 @@ class UpdateEnvironment extends Command
|
|||
$bar = $this->output->createProgressBar(count($variables));
|
||||
|
||||
foreach ($variables as $key => $value) {
|
||||
$newValue = $key . '=' . $value;
|
||||
if (str_contains($value, ' ') && ! str_contains($value, '"')) {
|
||||
$value = '"' . $value . '"';
|
||||
}
|
||||
$newValue = $key . '=' . $value . ' # DO NOT EDIT! set using pterodactyl:env';
|
||||
|
||||
if (preg_match_all('/^' . $key . '=(.*)$/m', $envContents) < 1) {
|
||||
$envContents = $envContents . "\n" . $newValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue