33 lines
662 B
PHP
Executable File
33 lines
662 B
PHP
Executable File
<?php
|
|
|
|
namespace Config;
|
|
|
|
use CodeIgniter\Config\BaseConfig;
|
|
|
|
class Api extends BaseConfig
|
|
{
|
|
public string $baseURL;
|
|
public int $timeout;
|
|
public array $defaultHeaders;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->baseURL = rtrim((string) env('API_BASE_URL', ''), '/');
|
|
$this->timeout = (int) env('API_TIMEOUT', 10);
|
|
|
|
$this->defaultHeaders = [
|
|
'Accept' => 'application/json',
|
|
];
|
|
|
|
$token = env('API_BEARER_TOKEN');
|
|
if ($token) {
|
|
$this->defaultHeaders['Authorization'] = 'Bearer ' . $token;
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
|