move config related code from main.go to config.go