service config

This commit is contained in:
CHIEFSOFT\ameye
2024-02-27 07:39:28 -05:00
parent 0548bcdce0
commit a7ccb493b3
3 changed files with 84 additions and 5 deletions
+2 -2
View File
@@ -68,6 +68,7 @@ class WrenchBanners extends BaseController
$current_env = $this->getSiteConfigurations("system.live");
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
$server_tag = $this->getSiteConfigurations("system.server_tag");
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
// echo "EXYTACT INPUT DATA HERE";
$raw_json = file_get_contents('php://input');
@@ -96,9 +97,8 @@ class WrenchBanners extends BaseController
break;
}
if ( $call_backend == true && $in["action"] !='' ){
$local_url = "http://10.10.10.120:3032/familybanners";
$local_url = "http://".$micro_service_net1.":3032/familybanners";
$out = $this->APIcall('GET', $local_url, $in);
}
else
+3 -1
View File
@@ -68,6 +68,8 @@ class WrenchJobs extends BaseController
$current_env = $this->getSiteConfigurations("system.live");
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
$server_tag = $this->getSiteConfigurations("system.server_tag");
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
// echo "EXYTACT INPUT DATA HERE";
$raw_json = file_get_contents('php://input');
@@ -98,7 +100,7 @@ class WrenchJobs extends BaseController
if ( $call_backend == true && $in["action"] !='' ){
$local_url = "http://10.10.10.120:3033/marketjobs";
$local_url = "http://".$micro_service_net1.":3033/marketjobs";
$out = $this->APIcall('GET', $local_url, $in);
}
else
+79 -2
View File
@@ -76,7 +76,80 @@ class WrenchResources extends BaseController
public function familyresources(){
log_message('critical', "WrenchResources-> " );
$res1['tab_categories'] = $this->CategoryData();
log_message('critical', "0001");
header('Access-Control-Allow-Origin: *');
log_message('critical', "WrenchBanners Path GATE 001");
$call_backend = true;
header("Access-Control-Allow-Headers: Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token");
log_message('critical', "0003");
header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Max-Age: 3600");
header('content-type: application/json; charset=utf-8');
$method = $_SERVER['REQUEST_METHOD'];
$ip_loc = $this->getIpData();
if ($method == "OPTIONS") {
header("HTTP/1.1 200 OK CORS");
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****" );
die();
}
//$request = service('request');
// what is the endpoint
$uri = urldecode(current_url(true));
$findme = '?';
$pos = strpos($uri, $findme);
if ($pos > 5) {
$uri = substr($uri, 0, $pos);
}
log_message('critical', "API-GATE URI -> ".$uri );
$pieces = explode('/', $uri);
$psc = count($pieces);
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
log_message('critical', "Enpoint-> ".$endpoint );
$endpoints = $this->endPointList();
$out = array();
$res1 = [];
if (array_key_exists($endpoint, $endpoints)) {
} else {
http_response_code(404);
// tell the user product does not exist
echo json_encode([
'message' => 'Endpoint not found.',
'URI' => $uri,
]);
}
$current_env = $this->getSiteConfigurations("system.live");
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
$server_tag = $this->getSiteConfigurations("system.server_tag");
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
// echo "EXYTACT INPUT DATA HERE";
$raw_json = file_get_contents('php://input');
$raw_array = json_decode($raw_json, true);
$local_out =[];
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
log_message('critical', "Enpoint LOC2 HERE -> ".$endpoint );
$get_param = $_GET['reqData'] ?? null;
$raw_array = ($get_param!=null) ? json_decode($get_param, true):[];
}
$in = $raw_array;
$in["loc"] = $_SERVER["REMOTE_ADDR"];
$res1['tab_categories'] = $this->getFamilyResourceCategory($in);
$res1['ask_categories'] = $this->AskCategoryData();
$res1['upload_types'] = $this->uploadTypes();
$res1['marketdata'] = $this->MarketData();
@@ -85,7 +158,11 @@ class WrenchResources extends BaseController
$res1['blogdata'] = $this->getBlogData();
return $this->response->setJson($res1);
}
private function getFamilyResourceCategory($in){
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
$local_url = "http://".$micro_service_net1.":3034/famresourcecat";
return $this->APIcall('GET', $local_url, $in);
}
private function AskCategoryData(){