Add factory method for setting up an instance based on env variables