Implement .env configuration

This commit is contained in:
Jason Thistlethwaite
2026-04-27 22:52:27 +00:00
parent 16feb51b12
commit 324084d419
8 changed files with 259 additions and 9 deletions
+5 -1
View File
@@ -5,9 +5,13 @@ declare(strict_types=1);
require_once __DIR__ . '/src/VoipMsResponse.php';
require_once __DIR__ . '/src/VoipMsClient.php';
require_once __DIR__ . '/src/EnvLoader.php';
use VoipMs\EnvLoader;
use VoipMs\VoipMsClient;
EnvLoader::load(__DIR__ . '/.env');
/**
* @return array<string, array{category: string, description: string, params?: list<string>, examples?: list<string>}>
*/
@@ -624,7 +628,7 @@ function parseCdrArguments(array $args): array
$params['date_to'] = $positionals[1];
}
$envTimezone = getenv('VOIPMS_TIMEZONE');
$envTimezone = getenv('VOIPMS_TIMEZONE') ?: getenv('DEFAULT_TIMEZONE');
if (!isset($params['timezone']) && is_string($envTimezone) && $envTimezone !== '') {
$params['timezone'] = $envTimezone;
}