Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions ProcessMaker/Http/Controllers/AboutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Exception;
use Illuminate\Foundation\PackageManifest;
use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
Expand Down Expand Up @@ -74,6 +75,8 @@ public function index()
$microServices = [$aiMicroService];
}

$microServices[] = $this->getScriptMicroService();

$nayraMicroService = $this->getNayraMicroServiceAbout();
if ($nayraMicroService) {
$microServices[] = $nayraMicroService;
Expand All @@ -98,6 +101,29 @@ public function index()
);
}

private function getScriptMicroService()
{
$info = [
'name' => 'Script Microservice',
'description' => 'Execute scripts in ProcessMaker',
'status' => 'Disabled',
];

if (config('script-runner-microservice.enabled')) {
$baseUrl = config('script-runner-microservice.base_url');
try {
$response = Http::timeout(3)
->get($baseUrl . '/accept-traffic')
->throw();
$info['status'] = $response->json()['message'] . ". Microservice is running at $baseUrl";
} catch (Exception $e) {
$info['status'] = "Error connecting to $baseUrl: " . $e->getMessage();
}
}

return $info;
}

private function getAiMicroService()
{
if (hasPackage('package-ai')) {
Expand Down
3 changes: 3 additions & 0 deletions resources/views/about/microservices.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
@if (isset($microService['version']))
<div><strong>Version:</strong> {{ $microService['version'] }}</div>
@endif
@if (isset($microService['status']))
<div><strong>Status:</strong> {{ $microService['status'] }}</div>
@endif
</small>
@if (!empty($microService['waiting']))
<i class="fas fa-sync fa-spin text-secondary waiting"></i>
Expand Down
Loading