server use singleton
move server setting to config.server
change event from repl to write