@@ -34,8 +34,8 @@ Require Entry:
34
34
## Configuration
35
35
36
36
First, 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 ) .
39
39
40
40
### Default Configuration
41
41
@@ -58,19 +58,21 @@ $config = new \DCarbone\PHPConsulAPI\Config([
58
58
'Scheme' => 'http or https', // [optional] defaults to "http"
59
59
'Datacenter' => 'name of datacenter', // [optional]
60
60
'HttpAuth' => 'user:pass', // [optional]
61
+ 'WaitTime' => '0s', // [optional] amount of time to wait on certain blockable endpoints. go time duration string format.
61
62
'Token' => 'auth token', // [optional] default auth token to use
62
63
'TokenFile' => 'file with auth token', // [optional] file containing auth token string
63
64
'InsecureSkipVerify' => false, // [optional] if set to true, ignores all SSL validation
64
65
'CAFile' => '', // [optional] path to ca cert file, see http://docs.guzzlephp.org/en/latest/request-options.html#verify
65
66
'CertFile' => '', // [optional] path to client public key. if set, requires KeyFile also be set
66
67
'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
67
69
]);
68
70
```
69
71
70
72
#### Configuration Note:
71
73
72
74
By 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
74
76
a list of the env var names.
75
77
76
78
For 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:
97
99
$consul = new \DCarbone\PHPConsulAPI\Consul($config);
98
100
```
99
101
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.
102
104
103
105
Once constructed, you interact with each Consul API via it's corresponding Client class:
104
106
105
107
``` 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 );
109
111
110
- var_dump($kv_list );
112
+ var_dump($kvResp->Value );
111
113
```
112
114
113
115
...as an example.
0 commit comments