Skip to content

Commit

Permalink
Backport of Fix code block examples on dns-static-lookups.mdx into re…
Browse files Browse the repository at this point in the history
…lease/1.14.x (#18892)

Fix code block examples on dns-static-lookups.mdx (#18880)

HCL and JSON configuration examples were being displayed in the same
code block. This commit separates the configurations to properly
display them as independent configuration examples.

Co-authored-by: Blake Covarrubias <[email protected]>
  • Loading branch information
hc-github-team-consul-core and blake authored Sep 19, 2023
1 parent 6605d86 commit d1fd088
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion website/content/docs/services/discovery/dns-static-lookups.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ rabbitmq.node1.dc1.consul. 0 IN A 10.1.11.20
If a service registered with Consul is configured with an explicit IP address or addresses in the [`address`](/consul/docs/services/configuration/services-configuration-reference#address) or [`tagged_address`](/consul/docs/services/configuration/services-configuration-reference#tagged_address) parameter, then Consul returns the hostname in the target field of the answer section for the DNS SRV query according to the following format:

```text
<hexadecimal-encoded IP>.addr.<datacenter>.consul`.
<hexadecimal-encoded IP>.addr.<datacenter>.consul.
```

In the following example, the `rabbitmq` service is registered with an explicit IPv4 address of `192.0.2.10`.

<CodeTabs>

```hcl
node_name = "node1"
Expand All @@ -213,6 +215,9 @@ services {
address = "192.0.2.10"
port = 5672
}
```

```json
{
"node_name": "node1",
"services": [
Expand All @@ -225,6 +230,8 @@ services {
}
```

</CodeTabs>

The following example SRV query response contains a single record with a hostname written as a hexadecimal value:

```shell-session
Expand All @@ -241,6 +248,8 @@ $ echo -n "c000020a" | perl -ne 'printf("%vd\n", pack("H*", $_))'

In the following example, the `rabbitmq` service is registered with an explicit IPv6 address of `2001:db8:1:2:cafe::1337`.

<CodeTabs>

```hcl
node_name = "node1"
Expand All @@ -249,6 +258,9 @@ services {
address = "2001:db8:1:2:cafe::1337"
port = 5672
}
```

```json
{
"node_name": "node1",
"services": [
Expand All @@ -261,6 +273,8 @@ services {
}
```

</CodeTabs>

The following example SRV query response contains a single record with a hostname written as a hexadecimal value:

```shell-session
Expand Down

0 comments on commit d1fd088

Please sign in to comment.