{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/beats/issues/715","labels_url":"https://api.github.com/repos/elastic/beats/issues/715/labels{/name}","comments_url":"https://api.github.com/repos/elastic/beats/issues/715/comments","events_url":"https://api.github.com/repos/elastic/beats/issues/715/events","html_url":"https://github.com/elastic/beats/pull/715","id":126539977,"number":715,"title":"Adding ability to expand environment variables used in config file","user":{"login":"andrewkroh","id":4565752,"avatar_url":"https://avatars.githubusercontent.com/u/4565752?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewkroh","html_url":"https://github.com/andrewkroh","followers_url":"https://api.github.com/users/andrewkroh/followers","following_url":"https://api.github.com/users/andrewkroh/following{/other_user}","gists_url":"https://api.github.com/users/andrewkroh/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewkroh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewkroh/subscriptions","organizations_url":"https://api.github.com/users/andrewkroh/orgs","repos_url":"https://api.github.com/users/andrewkroh/repos","events_url":"https://api.github.com/users/andrewkroh/events{/privacy}","received_events_url":"https://api.github.com/users/andrewkroh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/beats/labels/enhancement","name":"enhancement","color":"fbca04"},{"url":"https://api.github.com/repos/elastic/beats/labels/libbeat","name":"libbeat","color":"008000"},{"url":"https://api.github.com/repos/elastic/beats/labels/review","name":"review","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-13T23:23:28Z","updated_at":"2016-01-14T13:48:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elastic/beats/pulls/715","html_url":"https://github.com/elastic/beats/pull/715","diff_url":"https://github.com/elastic/beats/pull/715.diff","patch_url":"https://github.com/elastic/beats/pull/715.patch"},"body":"Adds feature requested in #114. If we choose to accept this enhancement then the documentation will need updated.\r\n\r\n### Overview\r\n\r\nThis feature replaces `${var}` or `$var` in config files according to the values of the current environment variables.\r\n- The replacement is case-sensitive and occurs before the YAML is parsed.\r\n- References to undefined variables are replaced by an empty string.\r\n- A default value can be given by using the form `${var:default value}`.\r\n\r\n### Examples\r\n\r\nInput | Environment | Output\r\n-------|------------------|---------\r\n`name: ${NAME}`|`export NAME=elastic`|`name: elastic`\r\n`name: $NAME`|`export NAME=elastic`|`name: elastic`\r\n`name: ${NAME:beats}`||`name: beats`\r\n`hosts: [$HOSTS]`|`export HOSTS=\"'localhost:9200', 'localhost:9202'\"`|`hosts: ['localhost:9200', 'localhost:9202']`\r\n\r\n### Troubleshooting\r\n\r\nWhen logging is enabled at the `info` level or higher, a message is logged for each environment variable replacement. For example:\r\n\r\n```\r\n2016/01/13 23:00:27.925523 cfgfile.go:87: INFO Replacing config environment variable '${NAME}' with 'elastic'\r\n2016/01/13 23:00:27.925786 cfgfile.go:87: INFO Replacing config environment variable '${HOSTS}' with ''localhost:9200', 'localhost:9202''\r\n```"},"comment":{"url":"https://api.github.com/repos/elastic/beats/issues/comments/171648820","html_url":"https://github.com/elastic/beats/pull/715#issuecomment-171648820","issue_url":"https://api.github.com/repos/elastic/beats/issues/715","id":171648820,"user":{"login":"tsg","id":101817,"avatar_url":"https://avatars.githubusercontent.com/u/101817?v=3","gravatar_id":"","url":"https://api.github.com/users/tsg","html_url":"https://github.com/tsg","followers_url":"https://api.github.com/users/tsg/followers","following_url":"https://api.github.com/users/tsg/following{/other_user}","gists_url":"https://api.github.com/users/tsg/gists{/gist_id}","starred_url":"https://api.github.com/users/tsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsg/subscriptions","organizations_url":"https://api.github.com/users/tsg/orgs","repos_url":"https://api.github.com/users/tsg/repos","events_url":"https://api.github.com/users/tsg/events{/privacy}","received_events_url":"https://api.github.com/users/tsg/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T13:48:32Z","updated_at":"2016-01-14T13:48:32Z","body":"I'm generally +1 on this one. I also like the other Elasticsearch config option, which is to overwrite variables from CLI with something like `-Dshipper.name=test`. Perhaps we only want one of these two features, since I think they solve the same problem, but the `-D` one is probably more difficult to implement."}}