Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Ability to include raw text from non-structured files #142

Closed
hairyhenderson opened this issue May 19, 2017 · 0 comments
Closed

Ability to include raw text from non-structured files #142

hairyhenderson opened this issue May 19, 2017 · 0 comments

Comments

@hairyhenderson
Copy link
Owner

hairyhenderson commented May 19, 2017

While datasource is useful, it only supports structured data. There are some cases where I need to just include the text from some source without worrying about whether it's structured data.

At first I'd thought of just enhancing datasource so that it falls back to pulling plain text for content-types it doesn't recognize, but it's possible that I could want to include a JSON file (or some other structured data) unparsed into the template.

So what I'm thinking is maybe a new function include that would support the same kinds of URLs as datasource, but just reads them and doesn't worry about parsing structured data.

The questions I'm pondering are:

  • am I overthinking this? does this just belong in datasource?
    • there's a compatibility risk here - if I read an XML file (for example) and get its raw text in one version of gomplate, but then add XML support later, datasource will stop returning a string and start returning a map - this would be bad!
  • would it make sense to take the same approach as datasource in how datasources are referenced (i.e. on the commandline with -d), or would it make more sense to in-line URLs
    • adding all manner of commandline arguments gets messy, but on the other hand hard-coding URLs in a template is undesirable. Perhaps there's a middle ground...

🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant