Skip to content

Commit 5f84065

Browse files
committed
Update transport docs (#220)
1 parent 55bbc07 commit 5f84065

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

README.md

+29-10
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,7 @@ const auto response = influxdb->execute("SHOW DATABASES");
120120

121121
## Transports
122122

123-
An underlying transport is fully configurable by passing an URI:
124-
```
125-
[protocol]://[username:password@]host:port[?db=database]
126-
127-
# Auth token:
128-
[protocol]://[token@]host:port[?db=database]
129-
```
130-
<br>
131-
List of supported transport is following:
123+
Supported transports:
132124

133125
| Name | Dependency | URI protocol | Sample URI |
134126
| ----------- |:-----------:|:--------------:| -------------------------------------:|
@@ -137,9 +129,36 @@ List of supported transport is following:
137129
| UDP | boost | `udp` | `udp://localhost:8094` |
138130
| Unix socket | boost | `unix` | `unix:///tmp/telegraf.sock` |
139131

140-
141132
<sup>i)</sup> boost is needed to support queries.
142133

134+
### Configuration by URI
135+
136+
An underlying transport is configurable by passing an URI. `[protocol]` determines the actual transport type:
137+
138+
```cpp
139+
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086?db=test");
140+
```
141+
142+
URI Format:
143+
144+
```
145+
[protocol]://[username:password@]host:port[?db=database]
146+
147+
# Auth token:
148+
[protocol]://[token@]host:port[?db=database]
149+
```
150+
151+
### Additional transport configuration *(HTTP only)*
152+
153+
The HTTP transport supports additional configurations beyond the limited URI parameters:
154+
155+
```cpp
156+
auto influxdb = InfluxDBBuilder::http("http://localhost:8086?db=test")
157+
.setTimeout(std::chrono::seconds{20})
158+
.setAuthToken("<token>")
159+
.connect();
160+
```
161+
143162
144163
## InfluxDB v2.x compatibility
145164

0 commit comments

Comments
 (0)