Split config into a separate file and add sanity check and test

Chasing #1246 

/cc @philips @unihorn @xiangli-cmu 
hrm, right, we should always check.