Skip to main content

Module token_source

Module token_source 

Source
Expand description

What --token-secret accepts, and the one source afhttp reads itself.

The grammar and every general source — env:NAME, file:PATH#DOT_PATH, literal: — come from AFDATA, which also renders the syntax into help and rejects an unacceptable one with the rest of the argv errors. What is left here is the part only afhttp can do: container:NAME, which reads a host token out of a container this binary manages. That token lives in a named volume, so no file path on this machine addresses it and no general source could reach it.

Functions§

parse
Classify one --token-secret value. Pure — argv has already been validated against the same set, so this only fails if the two ever disagree.
read
Read the token. A SecretString, so it reaches the Authorization header and nothing else — including a {:?} on whatever ends up holding it.
set
The sources --token-secret accepts, in both the places that must agree: the registry that validates argv, and the read that follows.