Skip to content

Commit 8b762cb

Browse files
committed
Also update service listing to accommodate no variables.
1 parent 9116547 commit 8b762cb

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
99
* Fixes 'Remember Me' checkbox being ignored when using 2FA on an account.
1010
* API now returns a useful error displaying what went wrong rather than an obscure 'An Error was Encountered' message when API issues arise.
1111
* Fixes bug preventing the creation of new files in the file manager due to a missing JS dependency on page load.
12-
* Prevent using a service option tag that contains special chaacters that are not valid. Now only allows alpha-numeric, no spaces or underscores.
12+
* Prevent using a service option tag that contains special characters that are not valid. Now only allows alpha-numeric, no spaces or underscores.
1313
* Fix unhandled excpetion due to missing `Log` class when using the API and causing an error.
1414

1515
### Changed

app/Http/Controllers/Daemon/OptionController.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public function details(Request $request, $server)
3838
return sprintf('%s=%s', $item->variable->env_variable, $item->variable_value);
3939
});
4040

41+
$mergeInto = [
42+
'STARTUP=' . $server->startup,
43+
'SERVER_MEMORY=' . $server->memory,
44+
'SERVER_IP=' . $server->allocation->ip,
45+
'SERVER_PORT=' . $server->allocation->port,
46+
];
47+
48+
if ($environment->count() === 0) {
49+
$environment = collect($mergeInto);
50+
}
51+
4152
return response()->json([
4253
'scripts' => [
4354
'install' => (! $server->option->copy_script_install) ? null : str_replace(["\r\n", "\n", "\r"], "\n", $server->option->copy_script_install),
@@ -47,12 +58,7 @@ public function details(Request $request, $server)
4758
'container' => $server->option->copy_script_container,
4859
'entry' => $server->option->copy_script_entry,
4960
],
50-
'env' => $environment->merge([
51-
'STARTUP=' . $server->startup,
52-
'SERVER_MEMORY=' . $server->memory,
53-
'SERVER_IP=' . $server->allocation->ip,
54-
'SERVER_PORT=' . $server->allocation->port,
55-
])->toArray(),
61+
'env' => $environment->toArray(),
5662
]);
5763
}
5864
}

0 commit comments

Comments
 (0)