set mode based on configuration