Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function |format

std/secret::|format


Usage

|format(template, entries, name)

Parameters

↳ template: string
↳ entries: Map (std/data/map::Map)
↳ name: string

Return

↴ Secret<string>


Secret made of template filled with entries, computed when revealed.

template contains braced placeholders, such as "Bearer {token}". entries maps placeholders to string or Secret<string> values, built with std/data/map::|map and |entry. Values can also be in an option, as |locate gives secrets: an empty option counts as no entry for its placeholder. The secret is named name, and gets the most restrictive combination of the policies of the secrets in entries.

Revealing fails if the template uses a placeholder with no entry, or if an entry is neither a string nor a Secret<string>.