diff --git a/CHANGELOG.md b/CHANGELOG.md index 47ee976ea..21da5ef8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * Fixes 'Remember Me' checkbox being ignored when using 2FA on an account. * API now returns a useful error displaying what went wrong rather than an obscure 'An Error was Encountered' message when API issues arise. * Fixes bug preventing the creation of new files in the file manager due to a missing JS dependency on page load. -* Prevent using a service option tag that contains special chaacters that are not valid. Now only allows alpha-numeric, no spaces or underscores. +* Prevent using a service option tag that contains special characters that are not valid. Now only allows alpha-numeric, no spaces or underscores. * Fix unhandled excpetion due to missing `Log` class when using the API and causing an error. ### Changed diff --git a/app/Http/Controllers/Daemon/OptionController.php b/app/Http/Controllers/Daemon/OptionController.php index e7aac2feb..9eb1806dc 100644 --- a/app/Http/Controllers/Daemon/OptionController.php +++ b/app/Http/Controllers/Daemon/OptionController.php @@ -38,6 +38,17 @@ class OptionController extends Controller return sprintf('%s=%s', $item->variable->env_variable, $item->variable_value); }); + $mergeInto = [ + 'STARTUP=' . $server->startup, + 'SERVER_MEMORY=' . $server->memory, + 'SERVER_IP=' . $server->allocation->ip, + 'SERVER_PORT=' . $server->allocation->port, + ]; + + if ($environment->count() === 0) { + $environment = collect($mergeInto); + } + return response()->json([ 'scripts' => [ 'install' => (! $server->option->copy_script_install) ? null : str_replace(["\r\n", "\n", "\r"], "\n", $server->option->copy_script_install), @@ -47,12 +58,7 @@ class OptionController extends Controller 'container' => $server->option->copy_script_container, 'entry' => $server->option->copy_script_entry, ], - 'env' => $environment->merge([ - 'STARTUP=' . $server->startup, - 'SERVER_MEMORY=' . $server->memory, - 'SERVER_IP=' . $server->allocation->ip, - 'SERVER_PORT=' . $server->allocation->port, - ])->toArray(), + 'env' => $environment->toArray(), ]); } }