From 93f0e66c9399dbabffdba32caac3406c83257936 Mon Sep 17 00:00:00 2001 From: wandoubaba Date: Tue, 4 Jul 2023 14:49:10 +0800 Subject: [PATCH] env --- auto_build.sh | 4 ---- deploy/start.php | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/auto_build.sh b/auto_build.sh index 20e8482..af06253 100644 --- a/auto_build.sh +++ b/auto_build.sh @@ -1,9 +1,5 @@ #!/bin/bash -# GIT_WORK_TREE=/www/wwwroot/fs.book.wandoubaba.com - -# cd $GIT_WORK_TREE - git pull origin master yarn install diff --git a/deploy/start.php b/deploy/start.php index 877650d..efb3bbf 100644 --- a/deploy/start.php +++ b/deploy/start.php @@ -17,9 +17,10 @@ $worker->onConnect = function ($connection) { }; $worker->onMessage = function (TcpConnection $connection, Request $request) { - $work_dir = '/www/wwwroot/fs.book.wandoubaba.com'; - $branch = 'master'; - $git_url = 'git@git.wandoubaba.com:wandoubaba/knowledge.git'; + $work_dir = isset($_ENV['WORK_DIR']) ? $_ENV['WORK_DIR'] : null; + $branch = isset($_ENV['BRANCH']) ? $_ENV['BRANCH'] : null; + $git_url = isset($_ENV['GIT_URL']) ? $_ENV['GIT_URL'] : null; + if ($work_dir && $branch && $git_url) { $repository = $request->post('repository'); if (is_array($repository)) { $ssh_url = isset($repository['ssh_url']) ? $repository['ssh_url'] : null; @@ -31,6 +32,7 @@ $worker->onMessage = function (TcpConnection $connection, Request $request) { $connection->close(); } } + } }; // 运行worker