Files
FendxPHP/config/config.php

121 lines
3.6 KiB
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
return [
'app' => require __DIR__ . '/app.php',
'database' => require __DIR__ . '/database.php',
'cache' => require __DIR__ . '/cache.php',
'security' => [
'token' => [
'secret' => 'your-secret-key-here',
'expire' => 7200, // 2小时
'issuer' => 'fendx',
'audience' => 'fendx-client',
'secret_key' => bin2hex(random_bytes(32)),
'expires_in' => 7200,
'algorithm' => 'HS256',
'cache_prefix' => 'token:',
],
'rate_limit' => 60,
'idempotent_ttl' => 300,
'super_admin_ids' => [1],
],
'log' => [
'level' => 'INFO',
'async' => true,
'max_files' => 30,
'max_size' => '10MB',
],
'web' => [
'cors' => [
'enabled' => true,
'origins' => ['*'],
'methods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
'headers' => ['Content-Type', 'Authorization', 'X-Requested-With'],
'credentials' => true,
],
],
'file' => [
'type' => 'local',
'root' => dirname(__DIR__) . '/runtime/storage',
'url_prefix' => '/storage'
],
'monitor' => [
'enabled' => true,
'sample_rate' => 1.0,
'health_timeout' => 5.0,
'disk_threshold' => 0.9,
'enabled_checks' => [
'database',
'cache',
'filesystem',
'memory',
'disk'
],
'alert_thresholds' => [
'memory_usage' => 0.8,
'cpu_usage' => 0.8,
'response_time' => 1.0,
'error_rate' => 0.05
],
'error_tracking' => [
'enabled' => true,
'max_errors' => 1000,
'retention_period' => 3600,
'notify_threshold' => 10,
'group_similar' => true,
'track_stack_trace' => true,
'track_request_info' => true
],
'alerts' => [
'enabled' => true,
'max_alerts' => 500,
'retention_period' => 7200,
'channels' => ['log'],
'thresholds' => [
'error_rate' => 0.05,
'memory_usage' => 0.9,
'disk_usage' => 0.95,
'response_time' => 2.0,
'critical_errors' => 5
],
'cooldown' => [
'error_rate' => 300,
'memory_usage' => 600,
'disk_usage' => 600,
'response_time' => 300,
'critical_errors' => 1800
]
],
'log_analysis' => [
'enabled' => true,
'log_paths' => [dirname(__DIR__) . '/runtime/logs'],
'max_file_size' => 50 * 1024 * 1024,
'index_cache_ttl' => 300,
'search_limit' => 1000,
'real_time' => true,
'patterns' => [
'error' => '/\b(ERROR|FATAL|CRITICAL)\b/i',
'warning' => '/\b(WARNING|WARN)\b/i',
'exception' => '/\b(Exception|Throwable)\b/i',
'sql' => '/\b(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER)\b/i',
'slow_query' => '/slow.*query|query.*slow/i',
'memory' => '/memory|Memory/i',
'performance' => '/performance|slow|timeout/i',
'security' => '/security|auth|login|logout|unauthorized/i'
]
],
'log_visualization' => [
'chart_width' => 800,
'chart_height' => 400,
'max_data_points' => 100,
'theme' => 'light'
]
],
];