cli: Stricter and safer config parsing.

Resolves #432.