Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取当时实例文档缺失ConfigInterface $config #1

Closed
21bigticket opened this issue Aug 9, 2020 · 2 comments
Closed

获取当时实例文档缺失ConfigInterface $config #1

21bigticket opened this issue Aug 9, 2020 · 2 comments

Comments

@21bigticket
Copy link

https://hyperf.wiki/2.0/#/zh-cn/nacos
文档说明获取当时实例:
$instance = new \Hyperf\Nacos\Instance();

看了Instance代码的实现,需要传ConfigInterface $config
`class Instance extends InstanceModel
{
public function __construct(ConfigInterface $config)
{
$client = $config->get('nacos.client', []);
if (! isset($client['service_name'])) {
throw new InvalidArgumentException('nacos.client.service_name is required');
}

    foreach ($client as $key => $val) {
        $key = Str::camel($key);
        if (property_exists($this, $key)) {
            $this->{$key} = $val;
        }
    }

    $this->ip = current(swoole_get_local_ip());
    $this->port = $config->get('server.servers.0.port');
}

}`

获取当前服务也是:
$service = new \Hyperf\Nacos\Service();

ConfigInterface $config好像传进去;可以更新一下文档吗?

@limingxinleo
Copy link
Member

直接使用 make 就可以了

@21bigticket
Copy link
Author

好,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants