Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add fileContents template func to read a file into a template. #261

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

jrasell
Copy link
Member

@jrasell jrasell commented Dec 17, 2018

Related #260

@jrasell
Copy link
Member Author

jrasell commented Dec 17, 2018

@cconstantine this adds at least the fileContents function which allows you to call a file and its contents will be read into the template.

@cconstantine
Copy link

My reading of this code is that the file contents aren't treated like a template, just a big string. This is useful to me (Thanks!), but it would be significantly more useful to me if the file read by fileContents could be a template.

@jrasell
Copy link
Member Author

jrasell commented Dec 17, 2018

@cconstantine reading the file contents as a template right off is tricky and not simple to solve. It would involve running the templater twice over the firstly the template read from file, then secondly over the job template so I want more time to think about this. This PR is only related to your issue, so wont close it.

As a potential work around for now, you could do something like the following:

levant render var='foo=bar'  -out=foobar.config foobar.config.tmpl && \
    levant deploy foobar.nomad 

Where the initial command renders out the config file, and the second then reads the rendered config file into the job file using the func added in this PR.

@jrasell jrasell merged commit f614622 into master Dec 18, 2018
@jrasell jrasell deleted the gh-260 branch February 2, 2019 10:17
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants