Use globals npm module to set environments

Resolves #1577