diff --git a/CHANGELOG.md b/CHANGELOG.md index 57096d1ca..860db8c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * Added ability to reinstall a server using the currently assigned service and option. * Added ability to change a server's service and service option, as well as change pack assignments and other management services in that regard. +### Changed +* Environment setting commands now attempt to auto-quote strings with spaces in them, as well as comment lines that are edited to avoid manual changes being overwritten. + ## v0.6.0-beta.2.1 (Courageous Carniadactylus) ### Fixed * `[beta.2]` — Suspended servers now show as suspended. diff --git a/app/Console/Commands/UpdateEmailSettings.php b/app/Console/Commands/UpdateEmailSettings.php index 679d94ee7..1e316d6cb 100644 --- a/app/Console/Commands/UpdateEmailSettings.php +++ b/app/Console/Commands/UpdateEmailSettings.php @@ -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; diff --git a/app/Console/Commands/UpdateEnvironment.php b/app/Console/Commands/UpdateEnvironment.php index 009efab2e..6252a2824 100644 --- a/app/Console/Commands/UpdateEnvironment.php +++ b/app/Console/Commands/UpdateEnvironment.php @@ -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;