refactor(logdrain): consolidate log drain stopping logic to reduce redundancy
This commit is contained in:
@@ -15,19 +15,18 @@ class StartLogDrain
|
|||||||
{
|
{
|
||||||
if ($server->settings->is_logdrain_newrelic_enabled) {
|
if ($server->settings->is_logdrain_newrelic_enabled) {
|
||||||
$type = 'newrelic';
|
$type = 'newrelic';
|
||||||
StopLogDrain::run($server);
|
|
||||||
} elseif ($server->settings->is_logdrain_highlight_enabled) {
|
} elseif ($server->settings->is_logdrain_highlight_enabled) {
|
||||||
$type = 'highlight';
|
$type = 'highlight';
|
||||||
StopLogDrain::run($server);
|
|
||||||
} elseif ($server->settings->is_logdrain_axiom_enabled) {
|
} elseif ($server->settings->is_logdrain_axiom_enabled) {
|
||||||
$type = 'axiom';
|
$type = 'axiom';
|
||||||
StopLogDrain::run($server);
|
|
||||||
} elseif ($server->settings->is_logdrain_custom_enabled) {
|
} elseif ($server->settings->is_logdrain_custom_enabled) {
|
||||||
$type = 'custom';
|
$type = 'custom';
|
||||||
StopLogDrain::run($server);
|
|
||||||
} else {
|
} else {
|
||||||
$type = 'none';
|
$type = 'none';
|
||||||
}
|
}
|
||||||
|
if ($type !== 'none') {
|
||||||
|
StopLogDrain::run($server);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if ($type === 'none') {
|
if ($type === 'none') {
|
||||||
return 'No log drain is enabled.';
|
return 'No log drain is enabled.';
|
||||||
@@ -186,7 +185,6 @@ Files:
|
|||||||
"echo '{$compose}' | base64 -d | tee $compose_path > /dev/null",
|
"echo '{$compose}' | base64 -d | tee $compose_path > /dev/null",
|
||||||
"echo '{$readme}' | base64 -d | tee $readme_path > /dev/null",
|
"echo '{$readme}' | base64 -d | tee $readme_path > /dev/null",
|
||||||
"test -f $config_path/.env && rm $config_path/.env",
|
"test -f $config_path/.env && rm $config_path/.env",
|
||||||
|
|
||||||
];
|
];
|
||||||
if ($type === 'newrelic') {
|
if ($type === 'newrelic') {
|
||||||
$add_envs_command = [
|
$add_envs_command = [
|
||||||
|
|||||||
Reference in New Issue
Block a user