Can't access a file using relative path in a template

I am trying to load file contents using

{{- file "./abc.json" | trimSpace }}

which consul returning stat: file not found error.

But I am able to access that file using absolute path. Does anyone know how can I access it using relative path?

Thanks!

The base path used to find a relative file is determined by the current path when consul-template is started. I was able to use a relative path by creating a directory, changing into it, creating a file abc.json and a template with what you gave. Then running consul template in that directory…

consul-template -once -template read-file.tmpl:out

The out file contains the contents of abc.json with space trimmed.