cleans up variable to hash conversion

Cleaner, more readable, better looking, .... implementation of converting the env var path to a hash and merging it with the existing config

Improves #2174