2019-05-01 18:21:11 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: Config Read'
|
2019-05-01 18:21:11 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul Config Read
|
|
|
|
|
|
|
|
Command: `consul config read`
|
|
|
|
|
2022-01-11 13:26:58 +00:00
|
|
|
Corresponding HTTP API Endpoint: [\[GET\] /v1/config/:kind/:name](/api-docs/config#get-configuration)
|
2022-01-10 17:40:11 +00:00
|
|
|
|
2019-05-08 20:19:37 +00:00
|
|
|
The `config read` command reads the config entry specified by the given
|
2019-05-01 18:21:11 +00:00
|
|
|
kind and name and outputs its JSON representation. See the
|
2020-10-14 15:23:05 +00:00
|
|
|
[configuration entries docs](/docs/agent/config-entries) for more
|
2019-05-08 20:19:37 +00:00
|
|
|
details about configuration entries.
|
2019-05-01 18:21:11 +00:00
|
|
|
|
2022-01-10 21:44:56 +00:00
|
|
|
The table below shows this command's [required ACLs](/api#authentication). Configuration of
|
|
|
|
[blocking queries](/api/features/blocking) and [agent caching](/api/features/caching)
|
|
|
|
are not supported from commands, but may be from the corresponding HTTP endpoint.
|
|
|
|
|
2022-01-11 14:41:54 +00:00
|
|
|
| ACL Required<sup>1</sup> |
|
|
|
|
| ------------------------------------- |
|
|
|
|
| `service:read`<br />`intentions:read` |
|
|
|
|
|
|
|
|
<sup>1</sup> The ACL required depends on the config entry kind being read:
|
|
|
|
|
|
|
|
| Config Entry Kind | Required ACL |
|
|
|
|
| ------------------- | ----------------- |
|
|
|
|
| ingress-gateway | `service:read` |
|
|
|
|
| proxy-defaults | `<none>` |
|
|
|
|
| service-defaults | `service:read` |
|
|
|
|
| service-intentions | `intentions:read` |
|
|
|
|
| service-resolver | `service:read` |
|
|
|
|
| service-router | `service:read` |
|
|
|
|
| service-splitter | `service:read` |
|
|
|
|
| terminating-gateway | `service:read` |
|
2022-01-10 21:44:56 +00:00
|
|
|
|
2019-05-01 18:21:11 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul config read [options]`
|
|
|
|
|
|
|
|
#### API Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_client.mdx'
|
2019-05-01 18:21:11 +00:00
|
|
|
|
2020-02-07 20:01:04 +00:00
|
|
|
#### Enterprise Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_namespace_options.mdx'
|
2020-02-07 20:01:04 +00:00
|
|
|
|
2021-12-15 01:55:21 +00:00
|
|
|
@include 'http_api_partition_options.mdx'
|
|
|
|
|
2019-05-01 18:21:11 +00:00
|
|
|
#### Config Read Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-kind` - Specifies the kind of the config entry to read.
|
2019-05-01 18:21:11 +00:00
|
|
|
|
2021-05-04 21:32:07 +00:00
|
|
|
- `-name` - Specifies the name of the config entry to read. The name of the
|
|
|
|
`proxy-defaults` config entry must be `global`, and the name of the `mesh`
|
|
|
|
config entry must be `mesh`.
|
2019-05-01 18:21:11 +00:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
$ consul config read -kind service-defaults -name web
|
|
|
|
{
|
|
|
|
"Kind": "service-defaults",
|
|
|
|
"Name": "web",
|
|
|
|
"Protocol": "http",
|
|
|
|
"CreateIndex": 13,
|
|
|
|
"ModifyIndex": 13
|
|
|
|
}
|