Exemplo n.º 1
0
func main() {
	transportFactory := thrift.NewTTransportFactory()
	protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
	transport, _ := thrift.NewTServerSocket("localhost:9091")
	handler := server.NewAdServerHandler()
	processor := service.NewAdServletProcessor(handler)
	server := thrift.NewTSimpleServer4(processor, transport, transportFactory, protocolFactory)

	server.Serve()
}
Exemplo n.º 2
0
		for _, app := range applications {
			err = dept.NewApplication(app)
			if err != nil {
				panic(err)
			}
		}
	},
}

var cmdFastCGI = &Command{
	Short: "run apply2 FastCGI server",
	Usage: "[KEY]",
	Run: func(args []string) {
		if len(args) == 0 {
			fmt.Printf("Generated random key. Any running sessions will fail.\n")
			server.Serve(dbconn.Host, dbconn.Port, rand16(), false)
		} else if len(args) == 1 {
			key, err := ioutil.ReadFile(args[0])
			if err != nil {
				panic(err)
			}
			server.Serve(dbconn.Host, dbconn.Port, key, false)
		} else {
			fmt.Print("Invalid arguments. Run 'apply2 help'.\n")
		}
	},
}

var cmdTestServer = &Command{
	Short: "run a test server",
	Usage: `[KEY]`,