hashicorp / hashicorp/consul-template
fileOrDefault method
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
### Consul Template version
Run `consul-template -v` to show the version. If you are not
running the latest version, please upgrade before submitting an
issue.
`consul-template v0.32.0 (a926131)`
### Expected behavior
The fact that the `file` function always returns an error if the file doesn't exist is a problem for me. I'd really like to have a `fileOrDefault` version as an analog of the [`keyOrDefault`](https://github.com/hashicorp/consul-template/blob/main/docs/templating-language.md#keyordefault) function.
### Actual behavior
`consul-template` crashes if the file doesn't exist.
Contributor guide
Research direction
Start by reading the existing `file` template function and the `keyOrDefault` documentation linked in the issue to understand the intended analogue. The work is done when a `fileOrDefault` function handles a missing file without crashing and returns the requested default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100