示例#1
0
func main() {
	conf.Use(configure.NewEnvironment())
	conf.Use(configure.NewFlag())

	conf.Parse()

	restrict.ReadCryptoKey(*crypto)

	models.Init(
		*dbUser,
		*dbPass,
		*dbService,
		*dbPort,
		*dbName,
	)

	fmt.Println("Welcome to pay.")

	r := mux.NewRouter().PathPrefix("/api").Subrouter().StrictSlash(true)

	r.HandleFunc("/ping", restrict.R(pingHandler)).
		Methods("GET")

	r.HandleFunc("/users", registerHandler).
		Methods("POST")
	r.HandleFunc("/users", loginHandler).
		Methods("GET")

	fmt.Println(http.ListenAndServe(":8080", r))
}
示例#2
0
文件: main.go 项目: BigRoom/vision
func init() {
	conf.Use(configure.NewEnvironment())
	conf.Use(configure.NewFlag())

	conf.Parse()

	messages = make(chan tunnel.MessageArgs)
	clients = make(map[string][]*conn)
}
示例#3
0
文件: bot.go 项目: BigRoom/profx
func main() {
	var err error

	conf.Use(configure.NewFlag())
	conf.Use(configure.NewEnvironment())
	conf.Parse()

	models.Init(
		*dbUser,
		*dbPass,
		*dbService,
		*dbPort,
		*dbName,
	)

	_, err = logrus_sentry.NewSentryHook(*sentryDSN, []log.Level{
		log.PanicLevel,
		log.FatalLevel,
		log.ErrorLevel,
	})

	if err != nil {
		log.WithFields(log.Fields{
			"error": err,
		}).Fatal("Unable to get connect to sentry")

		return
	}

	bot := ircx.Classic(*serverName, *name)

	log.WithFields(log.Fields{
		"address": *serverName,
	}).Info("Starting connection to the IRC server")

	reconnect(bot.Connect, "IRC")

	bot.HandleFunc(irc.RPL_WELCOME, registerHandler)
	bot.HandleFunc(irc.PING, pingHandler)
	bot.HandleFunc(irc.PRIVMSG, msgHandler)
	bot.HandleFunc(irc.INVITE, inviteHandler)

	log.WithFields(log.Fields{
		"address": *dispatch,
	}).Info("Starting connection to RPC the server")

	reconnect(connectRPC, "RPC")

	bot.HandleLoop()

	log.Println("finished")
}
示例#4
0
文件: pool.go 项目: BigRoom/zombies
func main() {
	var err error

	conf.Use(configure.NewEnvironment())
	conf.Use(configure.NewFlag())

	conf.Parse()

	sentry, err = raven.NewClient(*sentryDSN, nil)
	if err != nil {
		log.WithFields(log.Fields{
			"dsn":   *sentryDSN,
			"error": err,
		}).Warn("Could not connect to sentry")
	}

	rand.Seed(time.Now().UnixNano())
	uid = rand.Int63()

	setupETCD()

	pool = zombies.New()

	k := kite.New("pool", "1.0.0")

	k.Config.Port = *port
	k.Config.IP = "0.0.0.0"

	bindHandlers(k)

	go k.Run()

	<-k.ServerReadyNotify()

	log.WithFields(log.Fields{
		"port": k.Port,
		"ip":   k.Config.IP,
	}).Info("Pool is ready")

	<-k.ServerCloseNotify()
}
示例#5
0
文件: server.go 项目: paked/steel
func init() {
	conf.Use(configure.NewFlag())
	conf.Use(configure.NewJSONFromFile("config.json"))
}