Also update service listing to accommodate no variables.

This commit is contained in:
Dane Everitt 2017-05-24 20:42:31 -05:00
parent 9116547e98
commit 8b762cbaf5
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 13 additions and 7 deletions

View File

@ -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. * 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. * 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. * 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. * Fix unhandled excpetion due to missing `Log` class when using the API and causing an error.
### Changed ### Changed

View File

@ -38,6 +38,17 @@ class OptionController extends Controller
return sprintf('%s=%s', $item->variable->env_variable, $item->variable_value); 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([ return response()->json([
'scripts' => [ 'scripts' => [
'install' => (! $server->option->copy_script_install) ? null : str_replace(["\r\n", "\n", "\r"], "\n", $server->option->copy_script_install), '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, 'container' => $server->option->copy_script_container,
'entry' => $server->option->copy_script_entry, 'entry' => $server->option->copy_script_entry,
], ],
'env' => $environment->merge([ 'env' => $environment->toArray(),
'STARTUP=' . $server->startup,
'SERVER_MEMORY=' . $server->memory,
'SERVER_IP=' . $server->allocation->ip,
'SERVER_PORT=' . $server->allocation->port,
])->toArray(),
]); ]);
} }
} }