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

Chasing #1246 

/cc @philips @unihorn @xiangli-cmu 
unnecessary empty line?