Accounts is a nested json array:
{
"id": "accounts",
"dev": {
"postgres": {
"write": [
{
"user": "pgwrite",
"pass": "pgwrite"
}
],
"read": [
{
"user": "pgread",
"pass": "pgread"
}
],
"superuser": [
{
"user": "postgres",
"pass": "postgres"
}
]
}
}
}
This is the template functions:
{{$data := getenv "ACCOUNTS"}}
{{$accounts := json $data}}
{{$write := $accounts.dev.postgres.write}}
Accounts:
{{$accounts}}
Write:
{{$write}}
This is the template output:
Accounts:
map[id:accounts dev:map[postgres:map[write:[map[user:pgwrite pass:pgwrite]] read:[map[user:pgread pass:pgread]] superuser:[map[user:postgres pass:postgres]]]]]
Write:
[map[user:pgwrite pass:pgwrite]]
When I try to do anything with the $write variable, this is what I get:
2015-01-23T23:29:50Z e66c69f498ab confd[190]: WARNING Skipping confd config file.
2015-01-23T23:29:50Z e66c69f498ab confd[190]: ERROR template: app_override.tmpl:13:8: executing "app_override.tmpl" at <$write.user>: can't evaluate field user in type []interface {}
Things I have tried:
$write.user
{{with $write}}
key: {{.Key}}
value: {{.Value}}
{{end}}
$write[user]