Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rstgroup/zf-external-config-consul-provider
https://github.com/rstgroup/zf-external-config-consul-provider
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rstgroup/zf-external-config-consul-provider
- Owner: rstgroup
- License: mit
- Created: 2017-07-24T12:10:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-26T12:48:42.000Z (over 7 years ago)
- Last Synced: 2024-04-13T19:29:41.527Z (8 months ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 0
- Watchers: 13
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZF External Config - Consul Provider
This library contains provider that can fetch configuration from Consul Key/Value Storage.
## Installation
Require module with Composer:
```bash
composer require rstgroup/zf-external-config-consul-provider
```Then don't forget to enable provider and define factory in the `zf-config-module`'s
section of application's configuration:```php
return [
'rst_group' => [
'external_config' => [
'providers' => [
\RstGroup\ZfExternalConfigConsulProvider\ConsulConfigProvider::class,
],
'service_manager' => [
'factories' => [
\RstGroup\ZfExternalConfigConsulProvider\ConsulConfigProvider::class =>
\RstGroup\ZfExternalConfigConsulProvider\ConsulConfigProviderFactory::class
]
]
],
]
];
```## Configuration
Example configuration of provider might look just like this:
```php
return [
'rst_group' => [
'external_config' => [
'consul' => [
'prefix' => 'my-app/',
'http_client' => [
'base_uri' => 'http://consul.local:8500',
]
],
],
],
];
```The provider's configuration should be placed under `rsr_group.external_config.consul` key.
There are two sections:1. `prefix` key, which determines the base path in Consul's KV Storage. How it exactly works
you can read in
[`rstgroup/php-consul-kv-array-getter`'s documentation](https://github.com/rstgroup/php-consul-kv-array-getter).
If you don't provide `prefix`, provider will return all keys returned by Consul KV API.
2. `http_client` key, which contains options passed to `GuzzleHttp\Client` instance. The key that
should interest you is `base_uri` which determines the base location of Consul's API. By default it's value is
`http://127.0.0.1:8500`.
More information about possible options are described in [Guzzle Docs](http://docs.guzzlephp.org/en/stable/overview.html)
and in [Guzzle's repository](https://github.com/guzzle/guzzle/tree/6.3.0).