@@ -34,8 +34,8 @@ Require Entry:
3434## Configuration
3535
3636First, construct a [ Config] ( ./src/Config.php ) . This class is modeled quite closely after the
37- [ Config Struct] ( https://github.com/hashicorp/consul/blob/v1.0.0 /api/api.go#L202 ) present in the
38- [ Consul API Subpackage] ( https://github.com/hashicorp/consul/blob/v1.0.0 /api ) .
37+ [ Config Struct] ( https://github.com/hashicorp/consul/blob/v1.9.3 /api/api.go#L280 ) present in the
38+ [ Consul API Subpackage] ( https://github.com/hashicorp/consul/blob/v1.9.3 /api ) .
3939
4040### Default Configuration
4141
@@ -58,19 +58,21 @@ $config = new \DCarbone\PHPConsulAPI\Config([
5858 'Scheme' => 'http or https', // [optional] defaults to "http"
5959 'Datacenter' => 'name of datacenter', // [optional]
6060 'HttpAuth' => 'user:pass', // [optional]
61+ 'WaitTime' => '0s', // [optional] amount of time to wait on certain blockable endpoints. go time duration string format.
6162 'Token' => 'auth token', // [optional] default auth token to use
6263 'TokenFile' => 'file with auth token', // [optional] file containing auth token string
6364 'InsecureSkipVerify' => false, // [optional] if set to true, ignores all SSL validation
6465 'CAFile' => '', // [optional] path to ca cert file, see http://docs.guzzlephp.org/en/latest/request-options.html#verify
6566 'CertFile' => '', // [optional] path to client public key. if set, requires KeyFile also be set
6667 'KeyFile' => '', // [optional] path to client private key. if set, requires CertFile also be set
68+ 'JSONEncodeOpts'=> 0, // [optional] php json encode opt value to use when serializing requests
6769]);
6870```
6971
7072#### Configuration Note:
7173
7274By default, this client will attempt to locate a series of environment variables to describe much of the above
73- configuration properties. See [ here] ( ./src/Config.php#L450 ) for that list, and see [ here] ( ./src/Consul.php#L96 ) for
75+ configuration properties. See [ here] ( ./src/Config.php#L559 ) for that list, and see [ here] ( ./src/Consul.php#L40 ) for
7476a list of the env var names.
7577
7678For more advanced client configuration, such as proxy configuration, you must construct your own GuzzleHttp client
@@ -97,17 +99,17 @@ Next, construct a [Consul](./src/Consul.php) object:
9799$consul = new \DCarbone\PHPConsulAPI\Consul($config);
98100```
99101
100- * NOTE* : If you do not create your own config object, [ Consul] ( ./src/Consul.php#L78 ) will create it's own
101- using [ Config::newDefaultConfig()] ( ./src/Config.php#L147 ) and attempt to locate a suitable HTTP Client.
102+ * NOTE* : If you do not create your own config object, [ Consul] ( ./src/Consul.php#L171 ) will create it's own
103+ using [ Config::newDefaultConfig()] ( ./src/Config.php#L253 ) and attempt to locate a suitable HTTP Client.
102104
103105Once constructed, you interact with each Consul API via it's corresponding Client class:
104106
105107``` php
106- list($kv_list, $qm, $err) = $consul->KV->keys ();
107- if (null !== $err )
108- die($err );
108+ $kvResp = $consul->KV->Keys ();
109+ if (null !== $kvResp->Err )
110+ die($kvResp->Err );
109111
110- var_dump($kv_list );
112+ var_dump($kvResp->Value );
111113```
112114
113115...as an example.
0 commit comments