{"action":"created","issue":{"url":"https://api.github.com/repos/rebar/rebar3/issues/808","labels_url":"https://api.github.com/repos/rebar/rebar3/issues/808/labels{/name}","comments_url":"https://api.github.com/repos/rebar/rebar3/issues/808/comments","events_url":"https://api.github.com/repos/rebar/rebar3/issues/808/events","html_url":"https://github.com/rebar/rebar3/issues/808","id":106486334,"number":808,"title":"Support for pulling in application specific vars from file","user":{"login":"zugolosian","id":1028354,"avatar_url":"https://avatars.githubusercontent.com/u/1028354?v=3","gravatar_id":"","url":"https://api.github.com/users/zugolosian","html_url":"https://github.com/zugolosian","followers_url":"https://api.github.com/users/zugolosian/followers","following_url":"https://api.github.com/users/zugolosian/following{/other_user}","gists_url":"https://api.github.com/users/zugolosian/gists{/gist_id}","starred_url":"https://api.github.com/users/zugolosian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zugolosian/subscriptions","organizations_url":"https://api.github.com/users/zugolosian/orgs","repos_url":"https://api.github.com/users/zugolosian/repos","events_url":"https://api.github.com/users/zugolosian/events{/privacy}","received_events_url":"https://api.github.com/users/zugolosian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-15T06:03:42Z","updated_at":"2015-09-17T11:36:21Z","closed_at":null,"body":"I'd like to use the rebar3 templating system to create a template for building a debian package in a similar way to https://github.com/basho/node_package/blob/develop/priv/templates/deb/Makefile.bootstrap\r\n\r\nBecause making a debian package requires a fair number of variables that aren't global It'd be nice to have a way to pull those variables from a file. If this is already possible and I'm just not reading the documentation correctly feel free to give me a virtual slap and a point in the right direction.\r\n\r\nCheers"},"comment":{"url":"https://api.github.com/repos/rebar/rebar3/issues/comments/141050344","html_url":"https://github.com/rebar/rebar3/issues/808#issuecomment-141050344","issue_url":"https://api.github.com/repos/rebar/rebar3/issues/808","id":141050344,"user":{"login":"ferd","id":111141,"avatar_url":"https://avatars.githubusercontent.com/u/111141?v=3","gravatar_id":"","url":"https://api.github.com/users/ferd","html_url":"https://github.com/ferd","followers_url":"https://api.github.com/users/ferd/followers","following_url":"https://api.github.com/users/ferd/following{/other_user}","gists_url":"https://api.github.com/users/ferd/gists{/gist_id}","starred_url":"https://api.github.com/users/ferd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferd/subscriptions","organizations_url":"https://api.github.com/users/ferd/orgs","repos_url":"https://api.github.com/users/ferd/repos","events_url":"https://api.github.com/users/ferd/events{/privacy}","received_events_url":"https://api.github.com/users/ferd/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T11:36:21Z","updated_at":"2015-09-17T11:36:21Z","body":"I have a hard time with the implementation in #812. The problem being that it seemingly takes a variable value (`template_vars=...`), makes it a magical one that goes and finds files and reads its content to turn it into a set of variables of its own.\r\n\r\nThat variable isn't documented, if it's ever to be used any other way that doesn't point to a file, it causes a failure, and so on.\r\n\r\nThe templating mechanism was just not meant for that, and its design sadly leaves no good place for that kind of thing to take place without being an ugly shoehorned piece of code. The fix, if any, needs to come from the provider calling things directly.\r\n\r\nAlso I'm very much not sold on the idea of being the someone else looking after it!\r\n\r\nHere's an idea though: \"I guess the plugin could read the variable file in and pass it as an argument to rebar_templater:new/4\" is right, it's the nicest design format. Have your plugin rely on most vars being in a file if you must and make the provider use the var file as a first argument, rather than as the current one does (with the first argument being the project name), for example, and pass these in as if they were coming in from the command line.\r\n\r\nAlso we explicitly tell people not to rely on the internal modules like `rebar_templater` when writing plugins, because if we change them, we break plugins we do not own. If it's a risk you prefer not to take, just copy/paste the file and change the module name into your project (keep the license in place), and use it and tweak it however you like, and you'll be able to get some level of stability there."}}