func main() {
	configPath := kingpin.Flag("config", "Configuration path").Short('c').Required().String()
	kingpin.Parse()

	eventStreamConfig := config.NewEventStreamConfigFromJSONFile(configPath)

	rs := common.NewRedisSubscriber(eventStreamConfig.RedisConfig)
	go rs.Subscribe(eventStreamConfig.RedisConfig.PubSubChannel, msgChannel)

	e := echo.New()

	// Middleware
	e.Use(mw.Logger())
	e.Use(mw.Recover())

	e.Index(eventStreamConfig.StaticPath + "/index.html")
	e.Static("/", eventStreamConfig.StaticPath)
	e.Get("/api", apiHandler)

	log.Println("Event stream is running on port: %s", eventStreamConfig.Port)
	e.Run(":" + eventStreamConfig.Port)
}
func main() {
	configPath := kingpin.Flag("config", "Configuration path").Short('c').Required().String()

	kingpin.Parse()
	mongoConfig := config.NewMongoConfigFromJSONFile(configPath)

	sess, err := mgo.Dial(mongoConfig.MongoDBConfig.URL)
	if err != nil {
		log.Fatalln("Can't connect to mongo, error %v", err)
	}
	defer sess.Close()

	messagesCollection = sess.DB(mongoConfig.MongoDBConfig.DbName).C("messages")

	log.Println("Start listening for redis msg on channel: " + mongoConfig.RedisConfig.PubSubChannel)

	rs := common.NewRedisSubscriber(mongoConfig.RedisConfig)

	var msgChannel = make(chan *message.Message)

	go insertMessageToMongo(msgChannel)
	rs.Subscribe(mongoConfig.RedisConfig.PubSubChannel, msgChannel)
}
func main() {
	configPath := kingpin.Flag("config", "Configuration path").Short('c').Required().String()

	kingpin.Parse()
	loggerConfig := config.NewLoggerConfigFromJSONFile(configPath)

	logFile, err := os.OpenFile(loggerConfig.LogFilePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
	if err != nil {
		log.Fatalln("Failed to open warning log file")
	}
	defer logFile.Close()

	multiWriter := io.MultiWriter(logFile, os.Stderr)
	Logger = log.New(multiWriter, "", log.Ldate|log.Ltime)

	Logger.Println("Start listening for redis msg on channel: " + loggerConfig.RedisConfig.PubSubChannel)

	rs := common.NewRedisSubscriber(loggerConfig.RedisConfig)

	var msgChannel = make(chan *message.Message)

	go logMessage(msgChannel)
	rs.Subscribe(loggerConfig.RedisConfig.PubSubChannel, msgChannel)
}