15 lines
421 B
PHP
15 lines
421 B
PHP
<?php
|
|
if (!function_exists('intranet_env')) {
|
|
function intranet_env(string $name, ?string $default = null): string
|
|
{
|
|
$value = getenv($name);
|
|
if ($value === false || $value === '') {
|
|
if ($default !== null) {
|
|
return $default;
|
|
}
|
|
throw new RuntimeException("Missing required environment variable: {$name}");
|
|
}
|
|
return $value;
|
|
}
|
|
}
|