{"action":"created","issue":{"url":"https://api.github.com/repos/kelseyhightower/confd/issues/209","labels_url":"https://api.github.com/repos/kelseyhightower/confd/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/kelseyhightower/confd/issues/209/comments","events_url":"https://api.github.com/repos/kelseyhightower/confd/issues/209/events","html_url":"https://github.com/kelseyhightower/confd/issues/209","id":59181801,"number":209,"title":"How to do conditional logic","user":{"login":"cgswong","id":6033436,"avatar_url":"https://avatars.githubusercontent.com/u/6033436?v=3","gravatar_id":"","url":"https://api.github.com/users/cgswong","html_url":"https://github.com/cgswong","followers_url":"https://api.github.com/users/cgswong/followers","following_url":"https://api.github.com/users/cgswong/following{/other_user}","gists_url":"https://api.github.com/users/cgswong/gists{/gist_id}","starred_url":"https://api.github.com/users/cgswong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgswong/subscriptions","organizations_url":"https://api.github.com/users/cgswong/orgs","repos_url":"https://api.github.com/users/cgswong/repos","events_url":"https://api.github.com/users/cgswong/events{/privacy}","received_events_url":"https://api.github.com/users/cgswong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kelseyhightower/confd/labels/resource/template","name":"resource/template","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-27T02:48:14Z","updated_at":"2015-03-23T15:59:41Z","closed_at":"2015-03-23T13:30:32Z","body":"For the keys:\r\n```\r\n/services/logging/host/172.17.8.101\r\n/services/logging/host/172.17.8.102\r\n/services/logging/host/172.17.8.103\r\n```\r\n\r\nI have a JSON array for each as follows:\r\n```\r\n{\"host\":\"core-02\"\r\n,\"http_port\":9200\r\n,\"cluster_port\":9300\r\n,\"cluster_name\":\"es01\"}\r\n```\r\n\r\nHow would I do conditional logic to only use a comma between values used and not at the end. For example, for a single key the template file would end up with:\r\n```\r\nhost => [\"172.17.8.102:9200\"]\r\n```\r\nFor multiple key detected\r\n```\r\nhost => [\"172.17.8.102:9200\",\"172.17.8.101:9200\",\"172.17.8.103:9200\"]\r\n```\r\n\r\nI realize this is more of a Go text/template question perhaps."},"comment":{"url":"https://api.github.com/repos/kelseyhightower/confd/issues/comments/85065362","html_url":"https://github.com/kelseyhightower/confd/issues/209#issuecomment-85065362","issue_url":"https://api.github.com/repos/kelseyhightower/confd/issues/209","id":85065362,"user":{"login":"bacongobbler","id":1360539,"avatar_url":"https://avatars.githubusercontent.com/u/1360539?v=3","gravatar_id":"","url":"https://api.github.com/users/bacongobbler","html_url":"https://github.com/bacongobbler","followers_url":"https://api.github.com/users/bacongobbler/followers","following_url":"https://api.github.com/users/bacongobbler/following{/other_user}","gists_url":"https://api.github.com/users/bacongobbler/gists{/gist_id}","starred_url":"https://api.github.com/users/bacongobbler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bacongobbler/subscriptions","organizations_url":"https://api.github.com/users/bacongobbler/orgs","repos_url":"https://api.github.com/users/bacongobbler/repos","events_url":"https://api.github.com/users/bacongobbler/events{/privacy}","received_events_url":"https://api.github.com/users/bacongobbler/received_events","type":"User","site_admin":false},"created_at":"2015-03-23T15:59:41Z","updated_at":"2015-03-23T15:59:41Z","body":"Another handy function would be `join`: https://github.com/kelseyhightower/confd/blob/master/docs/templates.md#join"}}