Refactor: tools: Strip trailing whitespace in load_env_vars()
We consider the value invalid if anything besides whitespace or a
comment (beginning with '#') follows it on the line. Further, we ignore
all trailing whitespace after a valid value. So it's fine to strip all
trailing whitespace, including a newline if present, before processing.
Clearly we must now look for '\0' where we previously looked for '\n'.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>