Add errorhandler. fixed #1
Set configs depend on node environment