Files
hyperf_data/config/autoload/services.php
Aether 0c7142ad46 ..
2025-09-26 10:41:43 +08:00

57 lines
1.6 KiB
PHP

<?php
use MicroService\Contract\DataServiceInterface;
use function Hyperf\Support\env;
return [
'enable' => [
'discovery' => true,
'register' => true,
],
'consumers' => [
// 数据服务消费者配置
[
'name' => 'DataService',
'service' => DataServiceInterface::class,
'registry' => [
'protocol' => 'nacos',
'address' => 'http://192.168.28.199:8848/',
],
'protocol' => 'jsonrpc-http',
'options' => [
'timeout' => 0.5,
],
],
],
'providers' => [
[
'id' => 'hyperf-gateway',
'service' => 'hyperf-gateway',
'protocol' => 'jsonrpc-http',
'load_balancer' => 'random',
'registry' => [
'protocol' => 'nacos',
'address' => 'http://192.168.28.199:8848',
],
],
],
'drivers' => [
'nacos' => [
// nacos server url like https://nacos.hyperf.io, Priority is higher than host:port
// 'url' => '',
// The nacos host info
'host' => env('NACOS_HOST', '192.168.28.199'),
'port' => env('NACOS_PORT', 8848),
// The nacos account info
// 'username' => null,
// 'password' => null,
'guzzle' => [
'config' => null,
],
'group_name' => env('NACOS_GROUP', 'api'),
'namespace_id' => env('NACOS_NAMESPACE_ID', 'dev'),
'heartbeat' => 5,
],
],
];