moving environment config logic to eof