Added Config file

This commit is contained in:
Olu Amey
2021-09-06 18:03:19 -04:00
parent bb5590bebd
commit 518140e44a
2 changed files with 36 additions and 2 deletions
+34
View File
@@ -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' => ''
];
}
+2 -2
View File
@@ -52,7 +52,8 @@ class BaseController extends Controller {
}
protected function getBlogItems() {
$wpData = WpContentsClient::serviceGetBlogItems("http://172.31.4.19:8000");
$apiEndpointsConfig = config('ApiEndpoints');
$wpData = WpContentsClient::serviceGetBlogItems($apiEndpointsConfig->baseUrl);
$blog_post = array();
$blog_cnt =0;
foreach ($wpData[0]->payload as $item) {
@@ -69,7 +70,6 @@ class BaseController extends Controller {
$blog_cnt++;
array_push($blog_post, $itemA);
}
return $blog_post;
}