From b915854c09e8e9e4c8bbb4395f9acfc24dc095e3 Mon Sep 17 00:00:00 2001 From: dnomd343 Date: Thu, 11 Aug 2022 19:37:04 +0800 Subject: [PATCH] feat: add `--debug` option --- Dockerfile | 2 +- main.php | 4 ++++ src/Logger.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1c80cd..593bcb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,4 +34,4 @@ RUN apk add --no-cache nginx php8 php8-fpm php8-iconv php8-pcntl COPY --from=asset /asset/ / EXPOSE 1688/tcp 1689/tcp WORKDIR /kms-server/ -CMD ["php", "main.php"] +ENTRYPOINT ["php", "main.php"] diff --git a/main.php b/main.php index fe2230d..6932346 100644 --- a/main.php +++ b/main.php @@ -6,6 +6,10 @@ require_once './src/Daemon.php'; require_once './src/Logger.php'; require_once './src/Process.php'; +if (in_array('--debug', $argv)) { // debug mode + logging::$logLevel = logging::DEBUG; +} + $nginx = array( 'name' => 'nginx', 'command' => ['/usr/sbin/nginx'], diff --git a/src/Logger.php b/src/Logger.php index 1129ca4..62f782c 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -1,6 +1,6 @@ '37m', // white