hashicorp / hashicorp/consul-template

secretOrDefault

Open
#942 25 comments 21 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement vault waiting-reply
Dominant language
Go
Stars
4.8k
Forks
801
Avg merge
4h 5m
Merged PRs (30d)
6

Description

secret, for the case of (for example) a generic secret, blocks rendering of the template when the requested path does not exist, as in this case:

{{ with secret "www-bbs-dev/static/db_demo2" }}{{ .Data.db_demo2_pass }}{{ end }}

This produces the consul error (on latest git):

2017/05/25 23:25:31.775568 [WARN] (view) vault.read(www-bbs-dev/static/db_demo2): no secret exists at www-bbs-dev/static/db_demo2 (retry attempt 1 after "250ms")

It would be helpful for my purposes if there was the equivalent of keyOrDefault for secret that would let me emit a blank string and continue rendering the template.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the secret and keyOrDefault template functions. Done means a missing secret can render as an empty string and continue, while the supplied example no longer blocks template rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.