fix(Deploy Script): fix setting bugs

This commit is contained in:
cubic
2022-01-12 09:52:50 +08:00
parent afd8dbb12a
commit 891592e04e
5 changed files with 15 additions and 11 deletions

View File

@@ -40,5 +40,6 @@ users:
# gateway
gateway:
token: <codefever_community_api_token>
hooks: http://127.0.0.1/apiv1/internal/hooks
authHTTP: http://127.0.0.1/apiv1/internal/authHTTP
authSSH: http://127.0.0.1/apiv1/internal/authSSH

View File

@@ -9,10 +9,17 @@ if (!$action) {
exit(255);
}
$config = [
'endpoint' => 'http://cc.pgyer.appxia.cn/apiv1/internal/hooks',
'token' => 'codefever_community_api_token'
];
$config = yaml_parse_file(dirname(__FILE__, 4) . '/env.yaml');
if ($config['gateway'] && $config['gateway']['token'] && $config['gateway']['hooks']) {
$config = [
'endpoint' => $config['gateway']['hooks'],
'token' => $config['gateway']['token']
];
} else {
echo '[CodeFever Community]: Bad configuration, Contact site administrator if operation rejected!.';
exit(255);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['endpoint']);
@@ -54,7 +61,7 @@ if ($result) {
echo 'Request-ID: ' . $result['request-id'] . "\n";
}
} else {
echo 'Contact service@pgyer.com if operation rejected!';
echo 'Contact site administrator if operation rejected!';
}
exit(255);

View File

@@ -56,10 +56,6 @@ cd -
echo 'Composer libraries loaded!'
echo 'export PATH=$PATH:/usr/local/git/bin' >> /home/git/.bash_profile
echo 'Enviroment variable set!'
service codefever start
service php-fpm start
service nginx start

View File

@@ -111,7 +111,7 @@ function addAuthorizedKey(array $data)
$sshGateway = dirname(BASE_PATH) . '/ssh-gateway/shell/main';
$authorized = [
"command=\"{$sshGateway} \$SSH_ORIGINAL_COMMAND {$data['user']}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty",
"command=\"PATH=\$PATH:/usr/local/git/bin && {$sshGateway} \$SSH_ORIGINAL_COMMAND {$data['user']}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty",
$data['type'],
$data['key'],
$data['name'],

View File

@@ -911,7 +911,7 @@ default_socket_timeout = 60
; Be sure to appropriately set the extension_dir directive.
;
;extension=bz2
;extension=curl
extension=curl
;extension=ffi
;extension=ftp
;extension=fileinfo