hook: Replace broken ad-hoc implementation to get envvars
In the hook
package we have an ad-hoc implementation to retrieve an
environment variable's value from an array. This implementation has two
problems:
- It retrieves the first value instead of the last value as would be
done by `os.Getenv()` in case the environment variable is defined
multiple times.
- It can segfault in case the environment variable doesn't have an
equals sign in it.
Fix both bugs by instead using env.ExtractValue()
.
Changelog: fixed