Added config etcd component.

This commit is contained in:
李铭昕 2019-07-26 13:32:54 +08:00
parent 3dce42e846
commit b386fc8de3
7 changed files with 90 additions and 2 deletions

View File

@ -20,6 +20,7 @@
"google/protobuf": "^3.6.1", "google/protobuf": "^3.6.1",
"grpc/grpc": "^1.15", "grpc/grpc": "^1.15",
"guzzlehttp/guzzle": "^6.3", "guzzlehttp/guzzle": "^6.3",
"linkorb/etcd-php": "^1.6",
"monolog/monolog": "^1.24", "monolog/monolog": "^1.24",
"nesbot/carbon": "^2.0", "nesbot/carbon": "^2.0",
"nikic/fast-route": "^1.3", "nikic/fast-route": "^1.3",
@ -55,6 +56,7 @@
"hyperf/command": "self.version", "hyperf/command": "self.version",
"hyperf/config": "self.version", "hyperf/config": "self.version",
"hyperf/config-apollo": "self.version", "hyperf/config-apollo": "self.version",
"hyperf/config-etcd": "self.version",
"hyperf/constants": "self.version", "hyperf/constants": "self.version",
"hyperf/consul": "self.version", "hyperf/consul": "self.version",
"hyperf/contract": "self.version", "hyperf/contract": "self.version",
@ -109,6 +111,7 @@
"Hyperf\\Config\\": "src/config/src/", "Hyperf\\Config\\": "src/config/src/",
"Hyperf\\Command\\": "src/command/src/", "Hyperf\\Command\\": "src/command/src/",
"Hyperf\\ConfigApollo\\": "src/config-apollo/src/", "Hyperf\\ConfigApollo\\": "src/config-apollo/src/",
"Hyperf\\ConfigEtcd\\": "src/config-etcd/src/",
"Hyperf\\Constants\\": "src/constants/src/", "Hyperf\\Constants\\": "src/constants/src/",
"Hyperf\\Consul\\": "src/consul/src/", "Hyperf\\Consul\\": "src/consul/src/",
"Hyperf\\Contract\\": "src/contract/src/", "Hyperf\\Contract\\": "src/contract/src/",
@ -154,6 +157,7 @@
"HyperfTest\\AsyncQueue\\": "./src/async-queue/tests/", "HyperfTest\\AsyncQueue\\": "./src/async-queue/tests/",
"HyperfTest\\Cache\\": "./src/cache/tests/", "HyperfTest\\Cache\\": "./src/cache/tests/",
"HyperfTest\\ConfigApollo\\": "./src/config-apollo/tests/", "HyperfTest\\ConfigApollo\\": "./src/config-apollo/tests/",
"HyperfTest\\ConfigEtcd\\": "./src/config-etcd/tests/",
"HyperfTest\\Constants\\": "./src/constants/tests/", "HyperfTest\\Constants\\": "./src/constants/tests/",
"HyperfTest\\Consul\\": "./src/consul/tests/", "HyperfTest\\Consul\\": "./src/consul/tests/",
"HyperfTest\\Di\\": "./src/di/tests/", "HyperfTest\\Di\\": "./src/di/tests/",
@ -190,6 +194,7 @@
"Hyperf\\CircuitBreaker\\ConfigProvider", "Hyperf\\CircuitBreaker\\ConfigProvider",
"Hyperf\\Config\\ConfigProvider", "Hyperf\\Config\\ConfigProvider",
"Hyperf\\ConfigApollo\\ConfigProvider", "Hyperf\\ConfigApollo\\ConfigProvider",
"Hyperf\\ConfigEtcd\\ConfigProvider",
"Hyperf\\Devtool\\ConfigProvider", "Hyperf\\Devtool\\ConfigProvider",
"Hyperf\\DbConnection\\ConfigProvider", "Hyperf\\DbConnection\\ConfigProvider",
"Hyperf\\Di\\ConfigProvider", "Hyperf\\Di\\ConfigProvider",

1
src/config-etcd/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
/tests export-ignore

View File

@ -0,0 +1 @@
# Etcd

View File

@ -0,0 +1,50 @@
{
"name": "hyperf/config-etcd",
"type": "library",
"license": "MIT",
"keywords": [
"php",
"hyperf",
"etcd",
"config"
],
"description": "Etcd Config Center for Hyperf.",
"autoload": {
"psr-4": {
"Hyperf\\ConfigEtcd\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"HyperfTest\\ConfigEtcd\\": "tests/"
}
},
"require": {
"php": ">=7.2",
"ext-swoole": ">=4.3",
"hyperf/utils": "~1.0.0",
"hyperf/etcd": "~1.0.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"hyperf/testing": "1.0.*",
"phpstan/phpstan": "^0.10.5",
"swoft/swoole-ide-helper": "dev-master"
},
"config": {
"sort-packages": true
},
"scripts": {
"test": "co-phpunit -c phpunit.xml --colors=always",
"analyze": "phpstan analyse --memory-limit 300M -l 0 ./src",
"cs-fix": "php-cs-fixer fix $1"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"hyperf": {
"config": "Hyperf\\ConfigEtcd\\ConfigProvider"
}
}
}

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://doc.hyperf.io
* @contact group@hyperf.io
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Etcd;
class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => [
],
'commands' => [
],
'scan' => [
'paths' => [
__DIR__,
],
],
];
}
}

View File

@ -21,7 +21,7 @@
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
"ext-swoole": ">=4.3", "ext-swoole": ">=4.3",
"hyperf/utils": "1.0.*", "hyperf/utils": "~1.0.0",
"linkorb/etcd-php": "^1.6" "linkorb/etcd-php": "^1.6"
}, },
"require-dev": { "require-dev": {

View File

@ -10,7 +10,7 @@ declare(strict_types=1);
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
*/ */
namespace Hyperf\Etcd; namespace Hyperf\ConfigEtcd;
class ConfigProvider class ConfigProvider
{ {