hashicorp / hashicorp/consul-template
Document how to access meta
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
### Consul Template version
consul-template v0.22.0 (6cae10fe)
### Configuration
A simple service like this
```json
{
"haproxy-stats-i-0000000": {
"ID": "haproxy-stats-i-0000000",
"Service": "haproxy-stats",
"Tags": [
"published"
],
"Meta": {
"Environment": "development",
"Owner": "company",
"Service": "haproxy",
"URL": "haproxy.development.company.cloud"
},
"Port": 1936,
"Address": "",
"Weights": {
"Passing": 1,
"Warning": 1
},
"EnableTagOverride": false
}
}
```
### Expected behavior
I just wanted to print the URL, I'ld have done that in less than 1 minute with my usual python, ansible, jinja.
### Actual behavior
I banged my head 2 hours on the keyboard trying to print {{ .Meta.URL }}, fighting with "if", "with", "range", "services", ".", ... being unable to just print the whole data to understand where I was wrong.
Until I ended up reading the code and realized it's not Meta but ServiceMeta.
Now I think I hate the whole golang text.template & consul-template until tomorrow at least.
I know that's me being incompetent with strongly structured & whatever you call it language & derivated templating stuff. But please document how to access meta. If you don't fix the incoherence between consul api (runnning 1.6.1 btw) and consul-template. And maybe that's my fault for missing out the proper compatibility between consul & consul-template. But still.
Contributor guide
Research direction
No documentation file or test is named in the issue. Start by searching for ServiceMeta and the existing consul-template documentation, then use the supplied service metadata example to document the expression that accesses Meta.URL and clarify the difference from Consul's API representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100