1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00

👌 IMPROVE: Doctor CLI: Harmonize negative check result descriptions (closes #724)

This commit is contained in:
Gustl22 2020-11-05 12:05:59 +01:00
parent 1ddc246e0f
commit 4b021dba7a

View file

@ -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.'! 🥳');