Added Config file
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class ApiEndpoints extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Base Url
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* WP Data Gateway endpoint base url
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $baseUrl = 'http://172.31.4.19:8000';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Client Credentials
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Client credentials
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $clientCredentials = [
|
||||||
|
'username' => '',
|
||||||
|
'password' => ''
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -52,7 +52,8 @@ class BaseController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function getBlogItems() {
|
protected function getBlogItems() {
|
||||||
$wpData = WpContentsClient::serviceGetBlogItems("http://172.31.4.19:8000");
|
$apiEndpointsConfig = config('ApiEndpoints');
|
||||||
|
$wpData = WpContentsClient::serviceGetBlogItems($apiEndpointsConfig->baseUrl);
|
||||||
$blog_post = array();
|
$blog_post = array();
|
||||||
$blog_cnt =0;
|
$blog_cnt =0;
|
||||||
foreach ($wpData[0]->payload as $item) {
|
foreach ($wpData[0]->payload as $item) {
|
||||||
@@ -69,7 +70,6 @@ class BaseController extends Controller {
|
|||||||
$blog_cnt++;
|
$blog_cnt++;
|
||||||
array_push($blog_post, $itemA);
|
array_push($blog_post, $itemA);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $blog_post;
|
return $blog_post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user