Skip to main content

parse_users

Function parse_users 

Source
fn parse_users(raw: Option<&Value>) -> Result<HashMap<String, String>, String>
Expand description

Parses the users config into a username -> password map, accepting either shape:

  • a map (hand-written YAML): users: { alice: s3cret, bob: hunter2 }
  • an array of objects (what the web UI’s node editor emits for this field): users: [{ username: alice, password: s3cret }, ...]

The web UI serializes repeated-object fields as arrays, so accepting only the map shape means a basic-auth node configured with users in the editor is rejected at save time. proxy-rewrite’s add_headers already handles both shapes for the same reason; this mirrors it. Blank rows left in the editor (empty username) are skipped.