Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

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

Merged
jrasell merged 1 commit into
masterfrom
gh-260
Dec 18, 2018
Merged

jrasell merged 1 commit into
masterfrom
gh-260

Conversation

@jrasell

@jrasell jrasell commented Dec 17, 2018

Copy link
Copy Markdown
Member

Related #260

@jrasell

jrasell commented Dec 17, 2018

Copy link
Copy Markdown
Member Author

@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
Copy Markdown

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

jrasell commented Dec 17, 2018

Copy link
Copy Markdown
Member Author

@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址