-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Config Entry docs #5734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Config Entry docs #5734
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c24bc1c
Add api docs for the config entry endpoints
kyhavlov 6d9df49
Add enable_central_service_config field to agent docs
kyhavlov 9f391f8
Add docs for config entry CLI operations
kyhavlov 96595b6
Fix wording and links in config entry docs
kyhavlov 4c26464
Merge branch 'master' into config-entry-docs
kyhavlov c8c4b9a
Add links to the central service config option
kyhavlov 6a58359
Update the central service config setting description.
kyhavlov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,249 @@ | ||
| --- | ||
| layout: api | ||
| page_title: Config - HTTP API | ||
| sidebar_current: api-config | ||
| description: |- | ||
| The /config endpoints are for managing centralized configuration | ||
| in Consul. | ||
| --- | ||
|
|
||
| # Config HTTP Endpoint | ||
|
|
||
| The `/config` endpoints create, update, delete and query central configuration | ||
| entries registered with Consul. See the | ||
| [agent configuration](/docs/agent/options.html#enable_central_service_config) | ||
| for more information on how to enable this functionality for centrally | ||
| configuring services. | ||
|
|
||
| ## Apply Configuration | ||
|
|
||
| This endpoint creates or updates the given config entry. | ||
|
|
||
| | Method | Path | Produces | | ||
| | ------ | ---------------------------- | -------------------------- | | ||
| | `PUT` | `/config` | `application/json` | | ||
|
|
||
| The table below shows this endpoint's support for | ||
| [blocking queries](/api/features/blocking.html), | ||
| [consistency modes](/api/features/consistency.html), | ||
| [agent caching](/api/features/caching.html), and | ||
| [required ACLs](/api/index.html#authentication). | ||
|
|
||
| | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | | ||
| | ---------------- | ----------------- | ------------- | ------------- | | ||
| | `NO` | `none` | `none` | `service:write`<br>`operator:write`<sup>1</sup> | | ||
|
|
||
| <sup>1</sup> The ACL required depends on the config entry kind being updated: | ||
|
|
||
| | Config Entry Kind | Required ACL | | ||
| | ----------------- | ---------------- | | ||
| | service-defaults | `service:write` | | ||
| | proxy-defaults | `operator:write` | | ||
|
|
||
| ### Parameters | ||
|
|
||
| - `dc` `(string: "")` - Specifies the datacenter to query. This will default to | ||
| the datacenter of the agent being queried. This is specified as part of the | ||
| URL as a query parameter. | ||
|
|
||
| - `cas` `(int: 0)` - Specifies to use a Check-And-Set operation. If the index is | ||
| 0, Consul will only store the entry if it does not already exist. If the index is | ||
| non-zero, the entry is only set if the current index matches the `ModifyIndex` | ||
| of that entry. | ||
|
|
||
| ### Sample Payload | ||
|
|
||
|
|
||
| ```javascript | ||
| { | ||
| "Kind": "service-defaults", | ||
| "Name": "web", | ||
| "Protocol": "http", | ||
| "Connect": { | ||
| "SidecarProxy": false | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Sample Request | ||
|
|
||
| ```sh | ||
| $ curl \ | ||
| --request PUT \ | ||
| --data @payload \ | ||
| http://127.0.0.1:8500/v1/config | ||
| ``` | ||
|
|
||
| ## Get Configuration | ||
|
|
||
| This endpoint returns a specific config entry. | ||
|
|
||
| | Method | Path | Produces | | ||
| | ------ | ---------------------------- | -------------------------- | | ||
| | `GET` | `/config/:kind/:name` | `application/json` | | ||
|
|
||
| The table below shows this endpoint's support for | ||
| [blocking queries](/api/features/blocking.html), | ||
| [consistency modes](/api/features/consistency.html), | ||
| [agent caching](/api/features/caching.html), and | ||
| [required ACLs](/api/index.html#authentication). | ||
|
|
||
| | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | | ||
| | ---------------- | ----------------- | ------------- | ------------- | | ||
| | `YES` | `all` | `none` | `service:read`<sup>1</sup> | | ||
|
|
||
| <sup>1</sup> The ACL required depends on the config entry kind being read: | ||
|
|
||
| | Config Entry Kind | Required ACL | | ||
| | ----------------- | ---------------- | | ||
| | service-defaults | `service:read` | | ||
| | proxy-defaults | `<none>` | | ||
|
|
||
| ### Parameters | ||
|
|
||
| - `dc` `(string: "")` - Specifies the datacenter to query. This will default to | ||
| the datacenter of the agent being queried. This is specified as part of the | ||
| URL as a query parameter. | ||
|
|
||
| - `kind` `(string: <required>)` - Specifies the kind of the entry to read. This | ||
| is specified as part of the URL. | ||
|
|
||
| - `name` `(string: <required>)` - Specifies the name of the entry to read. This | ||
| is specified as part of the URL. | ||
|
|
||
| ### Sample Request | ||
|
|
||
| ```sh | ||
| $ curl \ | ||
| --request GET \ | ||
| http://127.0.0.1:8500/v1/config/service-defaults/web | ||
| ``` | ||
|
|
||
| ### Sample Response | ||
|
|
||
| ```json | ||
| { | ||
| "Kind": "service-defaults", | ||
| "Name": "web", | ||
| "Protocol": "http", | ||
| "Connect": { | ||
| "SidecarProxy": true | ||
| }, | ||
| "CreateIndex": 15, | ||
| "ModifyIndex": 35 | ||
| } | ||
| ``` | ||
|
|
||
| ## List Configurations | ||
|
|
||
| This endpoint returns all config entries of the given kind. | ||
|
|
||
| | Method | Path | Produces | | ||
| | ------ | ---------------------------- | -------------------------- | | ||
| | `GET` | `/config/:kind` | `application/json` | | ||
|
|
||
| The table below shows this endpoint's support for | ||
| [blocking queries](/api/features/blocking.html), | ||
| [consistency modes](/api/features/consistency.html), | ||
| [agent caching](/api/features/caching.html), and | ||
| [required ACLs](/api/index.html#authentication). | ||
|
|
||
| | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | | ||
| | ---------------- | ----------------- | ------------- | ------------- | | ||
| | `YES` | `all` | `none` | `service:read`<sup>1</sup> | | ||
|
|
||
| <sup>1</sup> The ACL required depends on the config entry kind being read: | ||
|
|
||
| | Config Entry Kind | Required ACL | | ||
| | ----------------- | ---------------- | | ||
| | service-defaults | `service:read` | | ||
| | proxy-defaults | `<none>` | | ||
|
|
||
| ### Parameters | ||
|
|
||
| - `dc` `(string: "")` - Specifies the datacenter to query. This will default to | ||
| the datacenter of the agent being queried. This is specified as part of the | ||
| URL as a query parameter. | ||
|
|
||
| - `kind` `(string: <required>)` - Specifies the kind of the entry to list. This | ||
| is specified as part of the URL. | ||
|
|
||
| ### Sample Request | ||
|
|
||
| ```sh | ||
| $ curl \ | ||
| --request GET \ | ||
| http://127.0.0.1:8500/v1/config/service-defaults | ||
| ``` | ||
|
|
||
| ### Sample Response | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "Kind": "service-defaults", | ||
| "Name": "db", | ||
| "Protocol": "tcp", | ||
| "Connect": { | ||
| "SidecarProxy": false | ||
| }, | ||
| "CreateIndex": 16, | ||
| "ModifyIndex": 16 | ||
| }, | ||
| { | ||
| "Kind": "service-defaults", | ||
| "Name": "web", | ||
| "Protocol": "http", | ||
| "Connect": { | ||
| "SidecarProxy": true | ||
| }, | ||
| "CreateIndex": 13, | ||
| "ModifyIndex": 13 | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| ## Delete Configuration | ||
|
|
||
| This endpoint creates or updates the given config entry. | ||
|
|
||
| | Method | Path | Produces | | ||
| | -------- | ---------------------------- | -------------------------- | | ||
| | `DELETE` | `/config/:kind/:name` | `application/json` | | ||
|
|
||
| The table below shows this endpoint's support for | ||
| [blocking queries](/api/features/blocking.html), | ||
| [consistency modes](/api/features/consistency.html), | ||
| [agent caching](/api/features/caching.html), and | ||
| [required ACLs](/api/index.html#authentication). | ||
|
|
||
| | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | | ||
| | ---------------- | ----------------- | ------------- | ------------- | | ||
| | `NO` | `none` | `none` | `service:write`<br>`operator:write`<sup>1</sup> | | ||
|
|
||
| <sup>1</sup> The ACL required depends on the config entry kind being deleted: | ||
|
|
||
| | Config Entry Kind | Required ACL | | ||
| | ----------------- | ---------------- | | ||
| | service-defaults | `service:write` | | ||
| | proxy-defaults | `operator:write` | | ||
|
|
||
| ### Parameters | ||
|
|
||
| - `dc` `(string: "")` - Specifies the datacenter to query. This will default to | ||
| the datacenter of the agent being queried. This is specified as part of the | ||
| URL as a query parameter. | ||
|
|
||
| - `kind` `(string: <required>)` - Specifies the kind of the entry to delete. This | ||
| is specified as part of the URL. | ||
|
|
||
| - `name` `(string: <required>)` - Specifies the name of the entry to delete. This | ||
| is specified as part of the URL. | ||
|
|
||
| ### Sample Request | ||
|
|
||
| ```sh | ||
| $ curl \ | ||
| --request DELETE \ | ||
| http://127.0.0.1:8500/v1/config/service-defaults/web | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| layout: "docs" | ||
| page_title: "Commands: Config" | ||
| sidebar_current: "docs-commands-config" | ||
| --- | ||
|
|
||
| # Consul Config | ||
|
|
||
| Command: `consul config` | ||
|
|
||
| The `config` command is used to interact with Consul's central configuration | ||
| system. It exposes commands for creating, updating, reading, and deleting | ||
| different kinds of config entries. See the | ||
| [agent configuration](/docs/agent/options.html#enable_central_service_config) | ||
| for more information on how to enable this functionality for centrally | ||
| configuring services. | ||
|
|
||
| ## Usage | ||
|
|
||
| Usage: `consul config <subcommand>` | ||
|
|
||
| For the exact documentation for your Consul version, run `consul config -h` to view | ||
| the complete list of subcommands. | ||
|
|
||
| ```text | ||
| Usage: consul config <subcommand> [options] [args] | ||
|
|
||
| This command has subcommands for interacting with Consul's centralized | ||
| configuration system. Here are some simple examples, and more detailed | ||
| examples are available in the subcommands or the documentation. | ||
|
|
||
| Write a config: | ||
|
|
||
| $ consul config write web.serviceconf.hcl | ||
|
|
||
| Read a config: | ||
|
|
||
| $ consul config read -kind service-defaults -name web | ||
|
|
||
| List all configs for a type: | ||
|
|
||
| $ consul config list -kind service-defaults | ||
|
|
||
| Delete a config: | ||
|
|
||
| $ consul config delete -kind service-defaults -name web | ||
|
|
||
| For more examples, ask for subcommand help or view the documentation. | ||
| ``` | ||
|
|
||
| For more information, examples, and usage about a subcommand, click on the name | ||
| of the subcommand in the sidebar. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| layout: "docs" | ||
| page_title: "Commands: Config Delete" | ||
| sidebar_current: "docs-commands-config-delete" | ||
| --- | ||
|
|
||
| # Consul Config Delete | ||
|
|
||
| Command: `consul config delete` | ||
|
|
||
| The `config delete` command deletes the configuration entry | ||
| specified by the kind and name. See the | ||
| [agent configuration](/docs/agent/options.html#enable_central_service_config) | ||
| for more information on how to enable this functionality for centrally | ||
| configuring services. | ||
|
|
||
| ## Usage | ||
|
|
||
| Usage: `consul config delete [options]` | ||
|
|
||
| #### API Options | ||
|
|
||
| <%= partial "docs/commands/http_api_options_client" %> | ||
|
|
||
| #### Config Delete Options | ||
|
|
||
| * `-kind` - Specifies the kind of the config entry to read. | ||
|
|
||
| * `-name` - Specifies the name of the config entry to read. | ||
|
|
||
| ## Examples | ||
|
|
||
| $ consul config delete -kind service-defaults -name web |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| layout: "docs" | ||
| page_title: "Commands: Config List" | ||
| sidebar_current: "docs-commands-config-list" | ||
| --- | ||
|
|
||
| # Consul Config List | ||
|
|
||
| Command: `consul config list` | ||
|
|
||
| The `config list` command lists all given config entries of the given kind. | ||
| See the | ||
| [agent configuration](/docs/agent/options.html#enable_central_service_config) | ||
| for more information on how to enable this functionality for centrally | ||
| configuring services. | ||
|
|
||
| ## Usage | ||
|
|
||
| Usage: `consul config list [options]` | ||
|
|
||
| #### API Options | ||
|
|
||
| <%= partial "docs/commands/http_api_options_client" %> | ||
|
|
||
| #### Config List Options | ||
|
|
||
| * `-kind` - Specifies the kind of the config entry to read. | ||
|
|
||
| ## Examples | ||
|
|
||
| $ consul config list -kind service-defaults | ||
| billing | ||
| db | ||
| web | ||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.