|
@ -68,12 +68,31 @@ function load_params(array $args): void { |
|
|
if (in_array('--debug', $args)) { // enter debug mode |
|
|
if (in_array('--debug', $args)) { // enter debug mode |
|
|
logging::$logLevel = logging::DEBUG; |
|
|
logging::$logLevel = logging::DEBUG; |
|
|
} |
|
|
} |
|
|
|
|
|
global $KMS_PORT, $HTTP_PORT; |
|
|
|
|
|
$KMS_PORT = intval(get_param('kms-port', strval($KMS_PORT))); |
|
|
|
|
|
$HTTP_PORT = intval(get_param('http-port', strval($HTTP_PORT))); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
global $KMS_PORT; |
|
|
function apply_params(): void { |
|
|
$KMS_PORT = intval(get_param('kms-port', '1688')); |
|
|
global $KMS_PORT, $HTTP_PORT; |
|
|
|
|
|
if ($KMS_PORT < 1 || $KMS_PORT > 65535) { // 1 ~ 65535 |
|
|
|
|
|
logging::critical('Illegal KMS Port -> ' . $KMS_PORT); |
|
|
|
|
|
// TODO: process crash |
|
|
|
|
|
} |
|
|
|
|
|
if ($HTTP_PORT < 1 || $HTTP_PORT > 65535) { // 1 ~ 65535 |
|
|
|
|
|
logging::critical('Illegal HTTP Port -> ' . $HTTP_PORT); |
|
|
|
|
|
// TODO: process crash |
|
|
|
|
|
} |
|
|
|
|
|
if ($KMS_PORT != 1688) { // not default kms port |
|
|
logging::warning('KMS Server Port -> ' . $KMS_PORT); |
|
|
logging::warning('KMS Server Port -> ' . $KMS_PORT); |
|
|
|
|
|
} else { |
|
|
# TODO: load http port |
|
|
logging::debug('KMS Server Port -> ' . $KMS_PORT); |
|
|
|
|
|
} |
|
|
|
|
|
if ($HTTP_PORT != 1689) { // not default http port |
|
|
|
|
|
logging::warning('HTTP Server Port -> ' . $HTTP_PORT); |
|
|
|
|
|
} else { |
|
|
|
|
|
logging::debug('HTTP Server Port -> ' . $HTTP_PORT); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
declare(ticks = 1); |
|
|
declare(ticks = 1); |
|
@ -92,13 +111,14 @@ pcntl_signal(SIGINT, function() { // receive SIGINT signal |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
load_params($argv); |
|
|
load_params($argv); |
|
|
|
|
|
apply_params(); |
|
|
|
|
|
# TODO: load vlmcsd process |
|
|
|
|
|
load_nginx_config($KMS_PORT, $HTTP_PORT); |
|
|
|
|
|
|
|
|
# TODO: check port between 1 to 65535 |
|
|
if ($KMS_PORT != 1688) { // not default kms port |
|
|
//if ($KMS_PORT != 1688) { |
|
|
array_push($VLMCSD['command'], '-P', strval($KMS_PORT)); |
|
|
// array_push($vlmcsd['command'], '-P', strval($KMS_PORT)); |
|
|
} |
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
load_nginx_config($KMS_PORT, $HTTP_PORT); |
|
|
|
|
|
|
|
|
|
|
|
logging::info('Loading kms-server (' . $VERSION . ')'); |
|
|
logging::info('Loading kms-server (' . $VERSION . ')'); |
|
|
new Process($NGINX['command']); |
|
|
new Process($NGINX['command']); |
|
|