From 4b021dba7a4e0951713477fc4e937681743e3acb Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Thu, 5 Nov 2020 12:05:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20Doctor=20CLI:=20Harmo?= =?UTF-8?q?nize=20negative=20check=20result=20descriptions=20(closes=20#72?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/tasks/doctor.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/tasks/doctor.php b/app/tasks/doctor.php index f152c90ea7..fc949d45c7 100644 --- a/app/tasks/doctor.php +++ b/app/tasks/doctor.php @@ -21,41 +21,41 @@ $cli Console::log("\n".'👩‍⚕️ Running '.APP_NAME.' Doctor for version '.App::getEnv('_APP_VERSION', 'UNKNOWN').' ...'."\n"); Console::log('Checking for production best practices...'); - + $domain = new Domain(App::getEnv('_APP_DOMAIN')); if(!$domain->isKnown() || $domain->isTest()) { - Console::log('🔴 Hostname has a public suffix ('.$domain->get().')'); + Console::log('🔴 Hostname has no public suffix ('.$domain->get().')'); } else { Console::log('🟢 Hostname has a public suffix ('.$domain->get().')'); } - + $domain = new Domain(App::getEnv('_APP_DOMAIN_TARGET')); if(!$domain->isKnown() || $domain->isTest()) { - Console::log('🔴 CNAME target has a public suffix ('.$domain->get().')'); + Console::log('🔴 CNAME target has no public suffix ('.$domain->get().')'); } else { Console::log('🟢 CNAME target has a public suffix ('.$domain->get().')'); } - + if(App::getEnv('_APP_OPENSSL_KEY_V1') === 'your-secret-key' || empty(App::getEnv('_APP_OPENSSL_KEY_V1'))) { - Console::log('🔴 Using a unique secret key for encryption'); + Console::log('🔴 Not using a unique secret key for encryption'); } else { Console::log('🟢 Using a unique secret key for encryption'); } if(App::getEnv('_APP_ENV', 'development') !== 'production') { - Console::log('🔴 App enviornment is set for production'); + Console::log('🔴 App environment is set for development'); } else { - Console::log('🟢 App enviornment is set for production'); + Console::log('🟢 App environment is set for production'); } if('enabled' !== App::getEnv('_APP_OPTIONS_ABUSE', 'disabled')) { - Console::log('🔴 Abuse protection is enabled'); + Console::log('🔴 Abuse protection is disabled'); } else { Console::log('🟢 Abuse protection is enabled'); @@ -74,7 +74,7 @@ $cli else { Console::log('🟢 Console access limits are enabled'); } - + if('enabled' !== App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled')) { Console::log('🔴 HTTPS force option is disabled'); } @@ -133,7 +133,7 @@ $cli $mail->Subject = 'Test SMTP Connection'; $mail->Body = 'Hello World'; $mail->AltBody = 'Hello World'; - + $mail->send(); Console::success('SMTP................connected 👍'); } catch (\Throwable $th) { @@ -143,7 +143,7 @@ $cli $host = App::getEnv('_APP_STATSD_HOST', 'telegraf'); $port = App::getEnv('_APP_STATSD_PORT', 8125); - if($fp = @\fsockopen('udp://'.$host, $port, $errCode, $errStr, 2)){ + if($fp = @\fsockopen('udp://'.$host, $port, $errCode, $errStr, 2)){ Console::success('StatsD..............connected 👍'); \fclose($fp); } else { @@ -153,7 +153,7 @@ $cli $host = App::getEnv('_APP_INFLUXDB_HOST', ''); $port = App::getEnv('_APP_INFLUXDB_PORT', ''); - if($fp = @\fsockopen($host, $port, $errCode, $errStr, 2)){ + if($fp = @\fsockopen($host, $port, $errCode, $errStr, 2)){ Console::success('InfluxDB............connected 👍'); \fclose($fp); } else { @@ -179,7 +179,7 @@ $cli else { Console::error('🔴 '.$key.' Volume is unreadable'); } - + if (\is_writable($device->getRoot())) { Console::success('🟢 '.$key.' Volume is writeable'); } @@ -203,9 +203,9 @@ $cli $percentage = (($device->getPartitionTotalSpace() - $device->getPartitionFreeSpace()) / $device->getPartitionTotalSpace()) * 100; - + $message = $key.' Volume has '.Storage::human($device->getPartitionFreeSpace()) . ' free space ('.\round($percentage, 2).'% used)'; - + if ($percentage < 80) { Console::success('🟢 ' . $message); } @@ -213,12 +213,12 @@ $cli Console::error('🔴 ' . $message); } } - + try { if(App::isProduction()) { Console::log(''); $version = \json_decode(@\file_get_contents(App::getEnv('_APP_HOME', 'http://localhost').'/v1/health/version'), true); - + if ($version && isset($version['version'])) { if(\version_compare($version['version'], App::getEnv('_APP_VERSION', 'UNKNOWN')) === 0) { Console::info('You are running the latest version of '.APP_NAME.'! 🥳');