Set environment prior to loading plugins to allow for more flexibility.