# Templates

## HashiCorp Consu&#x6C;**®**

If you want Tower to serve the configuration in a manner similar to HashiCorp's Consul, simply create a new [endpoint](/tower/user-interface/settings/api/endpoints-and-templates.md) with the following template:

```liquid
[
    {%- for var in variables -%}
    {
	"LockIndex": 0,
{% comment %}
Please customize the following line with the Base names that are relevant to your configuration.
{% endcomment -%}
	"Key": "{{Technology}}/{{Environment}}/{{Application}}/{{var.name}}",
	"Flags": 0,
	{% case var.type -%}
	{% when "string", "password" -%}
	"Value":"{{ var.value | tower_toBase64 }}",
	{% when "number", "boolean" -%}
	"Value":"{{ var.value | tower_toBase64 }}",
	{% when "list" -%}
    	{% assign insideList = var.value | join: "\",\"" -%}
    	{% assign l = "[\"" | concat: insideList | concat: "\"]" -%}
	"Value": "{{l | tower_toBase64}}",
	{% else -%}
	"Value":"{{ var.value | tower_toBase64 }}",
	{% endcase -%}
	{% assign random = "" | tower_random -%}
	"CreateIndex": "{{random}}",
    	"ModifyIndex": "{{random}}"
    	}{%- if forloop.last != true -%},{%- endif -%}
    {%- endfor %}
]
```

## Spring Cloud Config Server

If you want Tower to serve the configuration in a manner similar to Spring Cloud Config Server, simply create a new [endpoint](/tower/user-interface/settings/api/endpoints-and-templates.md) with the following template:

```liquid
{
{% comment %}
Please customize the following line with the Base names that are relevant to your configuration.
{% endcomment -%}
    "name": "{{Application}}",
    "profiles": [
{% comment %}
Please customize the following line with the Base names that are relevant to your configuration.
{% endcomment -%}
        "{{Environment}}"
    ],
    "label": "main",
    "version": "{{version}}",
    "state": null,
    "propertySources": [
        {
{% comment %}
Please customize the following line with the Base names that are relevant to your configuration.
{% endcomment -%}        
            "name": "http://tower/{{Technology}}/{{Application}}/{{Environment}}",
            "source": {
                {%- for var in variables -%}
                {% case var.type -%}
                {% when "string", "password" -%}
                "{{ var.name }}":"{{ var.value }}"{%- if forloop.last != true -%},{%- endif -%}
                {% when "number", "boolean" -%}
                "{{ var.name }}":{{ var.value }}{%- if forloop.last != true -%},{%- endif -%}
                {% when "list" -%}
                "{{ var.name }}":[{% for listVar in var.value -%}"{{ listVar }}"{%- if forloop.last != true -%},{% else %}]{%- endif -%}{%- endfor -%}{%- if forloop.last != true -%},{%- endif -%}
                {% else %}
                "{{ var.name }}":"{{ var.value }}"{%- if forloop.last != true -%},{%- endif -%}
                {% endcase -%}
                {%- endfor -%}
            }
        }
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rpsoft.gitbook.io/tower/rest-templates/templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
