diff --git a/src/Note/JsonRpc.php b/Annotation/JsonRpc.php similarity index 80% rename from src/Note/JsonRpc.php rename to Annotation/JsonRpc.php index fd61404..1aace44 100644 --- a/src/Note/JsonRpc.php +++ b/Annotation/JsonRpc.php @@ -1,13 +1,13 @@ uniqueId = preg_replace('/(\w{11})(\w{4})(\w{3})(\w{8})(\w{6})/', '$1-$2-$3-$4-$5', md5(__DIR__ . '.' . md5(Network::local()))); + $this->uniqueId = preg_replace('/(\w{11})(\w{4})(\w{3})(\w{8})(\w{6})/', '$1-$2-$3-$4-$5', md5(__DIR__ . 'Annotation' . md5(Network::local()))); } @@ -49,6 +50,9 @@ use ReflectionException; protected function create(): array { $rpcPort = Config::get('rpc.port'); + if (empty($this->checkUrl)) { + $this->checkUrl = Network::local() . ":" . Config::get('rpc.port'); + } $defaultConfig = [ "ID" => "rpc.json.{$this->service}." . $this->uniqueId, "Name" => $this->service, @@ -66,9 +70,9 @@ use ReflectionException; "Check" => [ "CheckId" => "service:rpc.json.{$this->service}." . $this->uniqueId, "Name" => "service " . $this->service . ' health check', - "Notes" => "Script based health check", + "Annotations" => "Script based health check", "ServiceID" => $this->service, - "TCP" => Network::local() . ":" . Config::get('rpc.port'), + "TCP" => $this->checkUrl, "Interval" => "5s", "Timeout" => "1s", "DeregisterCriticalServiceAfter" => "30s" diff --git a/src/ClientPool.php b/ClientPool.php similarity index 100% rename from src/ClientPool.php rename to ClientPool.php diff --git a/src/InvalidRpcParamsException.php b/InvalidRpcParamsException.php similarity index 100% rename from src/InvalidRpcParamsException.php rename to InvalidRpcParamsException.php diff --git a/src/JsonRpcConsumers.php b/JsonRpcConsumers.php similarity index 100% rename from src/JsonRpcConsumers.php rename to JsonRpcConsumers.php diff --git a/src/JsonRpcPoolTransporter.php b/JsonRpcPoolTransporter.php similarity index 97% rename from src/JsonRpcPoolTransporter.php rename to JsonRpcPoolTransporter.php index 0f3e87f..d583f77 100644 --- a/src/JsonRpcPoolTransporter.php +++ b/JsonRpcPoolTransporter.php @@ -2,7 +2,7 @@ namespace Kiri\Rpc; -use Note\Inject; +use Kiri\Annotation\Inject; use Exception; use Http\Message\Response; use Http\Message\Stream; diff --git a/src/JsonRpcTransporter.php b/JsonRpcTransporter.php similarity index 100% rename from src/JsonRpcTransporter.php rename to JsonRpcTransporter.php diff --git a/src/Luckdraw.php b/Luckdraw.php similarity index 100% rename from src/Luckdraw.php rename to Luckdraw.php diff --git a/src/OnJsonRpcInterface.php b/OnJsonRpcInterface.php similarity index 100% rename from src/OnJsonRpcInterface.php rename to OnJsonRpcInterface.php diff --git a/src/OnRpcConsumerInterface.php b/OnRpcConsumerInterface.php similarity index 100% rename from src/OnRpcConsumerInterface.php rename to OnRpcConsumerInterface.php diff --git a/src/RpcClientInterface.php b/RpcClientInterface.php similarity index 100% rename from src/RpcClientInterface.php rename to RpcClientInterface.php diff --git a/src/RpcJsonp.php b/RpcJsonp.php similarity index 98% rename from src/RpcJsonp.php rename to RpcJsonp.php index cdfc933..1a8ff0f 100644 --- a/src/RpcJsonp.php +++ b/RpcJsonp.php @@ -13,8 +13,8 @@ use Kiri\Context; use Kiri\Events\EventProvider; use Kiri\Exception\ConfigException; use Kiri\Kiri; -use Note\Inject; -use Note\Note; +use Kiri\Annotation\Inject; +use Kiri\Annotation\Annotation; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Psr\Http\Message\ServerRequestInterface; @@ -43,8 +43,8 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa public Router $router; - #[Inject(Note::class)] - public Note $annotation; + #[Inject(Annotation::class)] + public Annotation $annotation; diff --git a/src/RpcManager.php b/RpcManager.php similarity index 100% rename from src/RpcManager.php rename to RpcManager.php diff --git a/src/RpcServiceException.php b/RpcServiceException.php similarity index 100% rename from src/RpcServiceException.php rename to RpcServiceException.php diff --git a/src/TraitTransporter.php b/TraitTransporter.php similarity index 100% rename from src/TraitTransporter.php rename to TraitTransporter.php diff --git a/composer.json b/composer.json index d1f1183..35f6ef6 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "autoload": { "psr-4": { - "Kiri\\Rpc\\": "src/" + "Kiri\\Rpc\\": "./" } }, "require-dev": { diff --git a/src/config.php b/config.php similarity index 96% rename from src/config.php rename to config.php index 3453980..01e7763 100644 --- a/src/config.php +++ b/config.php @@ -61,7 +61,7 @@ return [ "node" => "t2.320", "checkId" => "service:redis1", "name" => "Redis health check", - "notes" => "Script based health check", + "Annotations" => "Script based health check", "status" => "passing", "serviceID" => "redis1", "definition" => [