monolog升级到3.5,mongodb升级到7.0,mongodb添加用户名密码,修复php代码中的bug

This commit is contained in:
wandoubaba 2024-02-23 12:36:12 +08:00
parent 53a189b1ef
commit 8effbfaa05
6 changed files with 28 additions and 23 deletions

View File

@ -49,12 +49,12 @@ SQLITE_DATABASE = "base_path() . '/database.sqlite'"
SQLITE_PREFIX = SQLITE_PREFIX =
# mongolog: mongodb记录日志 # mongolog: mongodb记录日志
MONGOLOG_URL = mongodb://127.0.0.1:27019 MONGOLOG_URL = mongodb://root:password@127.0.0.1:27019
MONGOLOG_HOST = 127.0.0.1 MONGOLOG_HOST = 127.0.0.1
MONGOLOG_PORT = 27019 MONGOLOG_PORT = 27019
MONGOLOG_DATABASE = log MONGOLOG_DATABASE = log
MONGOLOG_USERNAME = MONGOLOG_USERNAME = root
MONGOLOG_PASSWORD = MONGOLOG_PASSWORD = password
# log # log
LOG_MAX_FIlES = 30 LOG_MAX_FIlES = 30

View File

@ -13,13 +13,13 @@ class TestController
public function index(Request $request) public function index(Request $request)
{ {
$res = Container::make(Res::class); $res = Container::make(Res::class);
// Log::channel('default')->info(__CLASS__ . DIRECTORY_SEPARATOR . __FUNCTION__, $_SERVER); Log::channel('default')->info(__CLASS__ . DIRECTORY_SEPARATOR . __FUNCTION__, $request->all());
$logs = Db::connection('mongolog')->collection('request')->get(); $requestLogs = Db::connection('mongolog')->collection('request')->get();
// foreach ($logs as $log) { $defaultLogs = Db::connection('mongolog')->collection('default')->get();
// $log->delete(); $res->setData([
// } 'request' => $requestLogs,
// $logs->delete(); 'default' => $defaultLogs,
$res->setData($logs); ]);
return json($res); return json($res);
} }

View File

@ -24,7 +24,7 @@ class RequestLog implements MiddlewareInterface
* @var array * @var array
*/ */
protected $actionWhiteList = [ protected $actionWhiteList = [
'app\controller\testcontroller\index', // oss里的download不校验 'app\controller\testcontroller\index',
]; ];
public function process(Request $request, callable $next) : Response public function process(Request $request, callable $next) : Response

View File

@ -26,7 +26,7 @@
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
"workerman/webman-framework": "^1.5.0", "workerman/webman-framework": "^1.5.0",
"monolog/monolog": "^3.0", "monolog/monolog": "^3.5",
"vlucas/phpdotenv": "^5.5", "vlucas/phpdotenv": "^5.5",
"illuminate/database": "^10.0", "illuminate/database": "^10.0",
"illuminate/pagination": "^10.0", "illuminate/pagination": "^10.0",

2
api/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "b60184ef23f8e71843aa7695eed31518", "content-hash": "39ff7b274d51d63c430e0f1f75ef26f0",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",

View File

@ -1,6 +1,21 @@
version: "3.1" version: "3.1"
services: services:
log:
image: mongo:7.0
container_name: webman-jsonrpc-log
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: log
volumes:
- ./log/db:/data/db
- ./log/mongod.conf:/etc/mongod.conf
network_mode: host
command: ['mongod', '--config', '/etc/mongod.conf']
api: api:
image: wandoubaba517/workerman:8.1 image: wandoubaba517/workerman:8.1
container_name: webman-jsonrpc-api container_name: webman-jsonrpc-api
@ -14,13 +29,3 @@ services:
depends_on: depends_on:
- log - log
command: ['php', 'start.php', 'start'] command: ['php', 'start.php', 'start']
log:
image: mongo:6.0
container_name: webman-jsonrpc-log
restart: always
volumes:
- ./log/db:/data/db
- ./log/mongod.conf:/etc/mongod.conf
network_mode: host
command: ['mongod', '--config', '/etc/mongod.conf']