<?php declare(strict_types=1); if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit('Direct access denied.'); } class ServiceSecrets { private static ?array $secrets = null; private static function load(): array { if (self::$secrets !== null) { return self::$secrets; } $path = PRIVATE_DIR . '/services.secret.php'; if (!file_exists($path)) { error_log('[WARN] services.secret.php not found — service integrations disabled.'); self::$secrets = []; return self::$secrets; } $data = require_once $path; self::$secrets = is_array($data) ? $data : []; return self::$secrets; } public static function get(string $key, ?string $default = null): ?string { $secrets = self::load(); return $secrets[$key] ?? $default; } public static function hasService(string $key): bool { $secrets = self::load(); return isset($secrets[$key]) && $secrets[$key] !== ''; } } 