Browse Source

update: load kms server port

master
Dnomd343 2 years ago
parent
commit
fd8b79bfbb
  1. 15
      kms.php
  2. 8
      src/Basis.php
  3. 5
      src/Route.php

15
kms.php

@ -1,9 +1,7 @@
#!/usr/bin/env php8
<?php
# TODO: add PORT option
$version = 'v1.2.2';
$VERSION = 'v1.2.2';
require_once './src/Daemon.php';
require_once './src/Logger.php';
@ -42,11 +40,20 @@ pcntl_signal(SIGINT, function() { // receive SIGINT signal
subExit($nginx['pidFile'], $phpFpm['pidFile'], $vlmcsd['pidFile']);
});
$KMS_PORT = 1688; // kms expose port -> only in message output
if (sizeof(getopt('', ['port:'])) == 1) { // port option
$KMS_PORT = getopt('', ['port:'])['port'];
if (is_array($KMS_PORT)) {
$KMS_PORT = end($KMS_PORT);
}
}
if (in_array('--debug', $argv)) { // enter debug mode
logging::$logLevel = logging::DEBUG;
}
logging::info('Loading kms-server (' . $version . ')');
logging::info('Loading kms-server (' . $VERSION . ')');
new Process($nginx['command']);
logging::info('Start nginx server...OK');
new Process($phpFpm['command']);

8
src/Basis.php

@ -64,6 +64,14 @@ function getHost(): string {
return (isHost($host)) ? $host : 'KMS_HOST';
}
function getPort(): int {
// TODO: check env
echo 'KMS_PORT -> ' . getenv("KMS_PORT");
return 1688;
}
function officeInfo(): array { // office dir and kms key for different version
return array(
'2010' => ['Office14', 'VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB'],

5
src/Route.php

@ -5,11 +5,8 @@ require_once 'Check.php';
require_once 'KmsCli.php';
require_once 'KmsWeb.php';
// TODO: get kms port from env
//$kmsPort = 1688;
$kmsPort = 1689;
$kmsHost = getHost(); // kms server address
$kmsPort = getPort(); // kms server port
$url = $_SERVER['DOCUMENT_URI']; // request url
$isCli = ($_GET['cli'] == 'true'); // shell or web browser

Loading…
Cancel
Save