diff --git a/backend/.watcher.php b/backend/.watcher.php new file mode 100644 index 0000000..39f4bab --- /dev/null +++ b/backend/.watcher.php @@ -0,0 +1,23 @@ + ScanFileDriver::class, + 'bin' => PHP_BINARY, + 'watch' => [ + 'dir' => ['app', 'config'], + 'file' => ['.env'], + 'scan_interval' => 2000, + ], + 'ext' => ['.php', '.env'], +]; diff --git a/backend/composer.json b/backend/composer.json index 7b4a416..9e5cb7c 100644 --- a/backend/composer.json +++ b/backend/composer.json @@ -28,12 +28,14 @@ "hyperf/http-server": "~3.1.0", "hyperf/logger": "~3.1.0", "hyperf/memory": "~3.1.0", - "hyperf/process": "~3.1.0" + "hyperf/process": "~3.1.0", + "hyperf/rate-limit": "^3.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", "hyperf/devtool": "~3.1.0", "hyperf/testing": "~3.1.0", + "hyperf/watcher": "^3.1", "mockery/mockery": "^1.0", "phpstan/phpstan": "^1.0", "swoole/ide-helper": "^5.0", diff --git a/backend/config/autoload/rate_limit.php b/backend/config/autoload/rate_limit.php new file mode 100644 index 0000000..bdf8151 --- /dev/null +++ b/backend/config/autoload/rate_limit.php @@ -0,0 +1,31 @@ + 1, + 'consume' => 1, + 'capacity' => 2, + 'limitCallback' => [], + 'waitTimeout' => 1, + 'storage' => [ + // 'class' => RedisStorage::class, + 'class' => EmptyStorage::class, + 'options' => [ + 'pool' => 'default', + 'expired_time' => 0, + ], + ], +];