4
4
5
5
use Exception ;
6
6
use Illuminate \Foundation \PackageManifest ;
7
+ use Illuminate \Http \Client \RequestException ;
7
8
use Illuminate \Support \Facades \Cache ;
8
9
use Illuminate \Support \Facades \Http ;
9
10
use Illuminate \Support \Facades \Log ;
@@ -74,6 +75,8 @@ public function index()
74
75
$ microServices = [$ aiMicroService ];
75
76
}
76
77
78
+ $ microServices [] = $ this ->getScriptMicroService ();
79
+
77
80
$ nayraMicroService = $ this ->getNayraMicroServiceAbout ();
78
81
if ($ nayraMicroService ) {
79
82
$ microServices [] = $ nayraMicroService ;
@@ -98,6 +101,29 @@ public function index()
98
101
);
99
102
}
100
103
104
+ private function getScriptMicroService ()
105
+ {
106
+ $ info = [
107
+ 'name ' => 'Script Microservice ' ,
108
+ 'description ' => 'Execute scripts in ProcessMaker ' ,
109
+ 'status ' => 'Disabled ' ,
110
+ ];
111
+
112
+ if (config ('script-runner-microservice.enabled ' )) {
113
+ $ baseUrl = config ('script-runner-microservice.base_url ' );
114
+ try {
115
+ $ response = Http::timeout (3 )
116
+ ->get ($ baseUrl . '/accept-traffic ' )
117
+ ->throw ();
118
+ $ info ['status ' ] = $ response ->json ()['message ' ] . ". Microservice is running at $ baseUrl " ;
119
+ } catch (Exception $ e ) {
120
+ $ info ['status ' ] = "Error connecting to $ baseUrl: " . $ e ->getMessage ();
121
+ }
122
+ }
123
+
124
+ return $ info ;
125
+ }
126
+
101
127
private function getAiMicroService ()
102
128
{
103
129
if (hasPackage ('package-ai ' )) {
0 commit comments