Skip to content

Commit 3fd4e77

Browse files
committed
docs(influxdb3): Add code-placeholders and tabbed examples for admin token creation (#6020)
1 parent 9f57a4b commit 3fd4e77

File tree

1 file changed

+33
-4
lines changed
  • content/shared/v3-enterprise-get-started

1 file changed

+33
-4
lines changed

content/shared/v3-enterprise-get-started/_index.md

+33-4
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,40 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the
282282

283283
To create an admin token, use the `influxdb3 create token --admin` subcommand--for example:
284284

285+
{{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}}
286+
287+
{{< code-tabs-wrapper >}}
288+
289+
{{% code-tabs %}}
290+
[CLI](#)
291+
[Docker](#)
292+
{{% /code-tabs %}}
293+
294+
{{% code-tab-content %}}
285295
```bash
286296
influxdb3 create token --admin \
287-
--host http://{{< influxdb/host >}}
297+
--host http://INFLUXDB_HOST
288298
```
299+
{{% /code-tab-content %}}
300+
301+
{{% code-tab-content %}}
302+
289303
```bash
290-
# With Docker -- In a new terminal, run:
304+
# With Docker — in a new terminal:
291305
docker exec -it CONTAINER_NAME influxdb3 create token --admin
292306
```
293307

308+
{{% /code-tab-content %}}
309+
310+
{{< /code-tabs-wrapper >}}
311+
312+
Replace the following:
313+
314+
- {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`)
315+
- {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container
316+
317+
{{% /code-placeholders %}}
318+
294319
The command returns a token string that you can use to authenticate CLI commands and API requests.
295320

296321
After you have created an admin token, you can use it to create database tokens and system tokens.
@@ -327,8 +352,7 @@ influxdb3 create token \
327352
```
328353
{{% /code-placeholders %}}
329354

330-
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}}
331-
with the admin token you created earlier.
355+
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier.
332356

333357
#### Create a system token
334358

@@ -355,6 +379,8 @@ To create a system token, use the `influxdb3 create token` subcommand and pass t
355379

356380
The following example shows how to create a system token that expires in 1 year and has read permissions for all system endpoints on the server:
357381

382+
{{% code-placeholders "ADMIN_TOKEN" %}}
383+
358384
```bash
359385
influxdb3 create token \
360386
--permission \
@@ -364,6 +390,9 @@ influxdb3 create token \
364390
--name "all system endpoints" \
365391
"system:*:read"
366392
```
393+
{{% /code-placeholders %}}
394+
395+
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier.
367396

368397
For more information, see how to [Manage resource tokens](/influxdb3/version/admin/tokens/resource/).
369398

0 commit comments

Comments
 (0)