veo3-report/env_loader.php
Dave Porter fe60d87dcb Add Microsoft Azure AD SSO authentication
- Integrated MSAL authentication for web pages
- Added AuthMiddleware.php for SSO orchestration
- Added JWTValidator.php for token validation
- Protected report.php and webhook_caller.php
- Firebase PHP-JWT for token verification
- SSO can be disabled for local development
- Complete SSO setup documentation
- Environment-based configuration
2026-01-07 12:43:42 -05:00

35 lines
907 B
PHP

<?php
/**
* Simple .env file loader
* Loads environment variables from .env file into $_ENV and getenv()
*/
$envFile = __DIR__ . '/.env';
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
// Skip comments
if (strpos(trim($line), '#') === 0) {
continue;
}
// Parse KEY=VALUE
if (strpos($line, '=') !== false) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
// Remove quotes if present
if (preg_match('/^(["\'])(.*)\\1$/', $value, $matches)) {
$value = $matches[2];
}
// Set environment variable
putenv("$key=$value");
$_ENV[$key] = $value;
$_SERVER[$key] = $value;
}
}
}