refactor setting and load routes based on environment variables