Reordered server startup code to allow user to set environment variables from settings file