Skip to content

hook: Replace broken ad-hoc implementation to get envvars

Patrick Steinhardt requested to merge pks-hooks-replace-broken-getenvvar into master

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

Merge request reports