File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717use libs \utils \CacheRegions ;
1818// public api ( without AUTHZ [OAUTH2.0])
1919
20+ Route::get ('/version ' , function () {
21+ $ versionFile = base_path ('version.json ' );
22+
23+ // Check if file exists
24+ if (!file_exists ($ versionFile )) {
25+ return response ()->json (['error ' => 'Version information not found ' ], 404 );
26+ }
27+
28+ // Read file contents
29+ $ contents = file_get_contents ($ versionFile );
30+
31+ // Decode JSON
32+ $ versionData = json_decode ($ contents , true );
33+
34+ // Check if JSON is valid or empty
35+ if ($ versionData === null && json_last_error () !== JSON_ERROR_NONE ) {
36+ return response ()->json (['error ' => 'Version information malformed ' ], 412 );
37+ }
38+
39+ if (empty ($ versionData )) {
40+ return response ()->json (['error ' => 'Version information malformed ' ], 412 );
41+ }
42+
43+ return response ()->json ($ versionData , 200 );
44+ });
2045
2146Route::group (['prefix ' => 'sponsored-projects ' ], function (){
2247 Route::get ('' , 'OAuth2SponsoredProjectApiController@getAll ' );
Original file line number Diff line number Diff line change 1+ {
2+ "service" : " summit-api" ,
3+ "git_sha" : " dev" ,
4+ "git_tag" : " dev"
5+ }
You can’t perform that action at this time.
0 commit comments