Improve environment/profile handling to use NODE_ENV