db/connect.go
func Connect() {
	uri := os.Getenv("MONGODB_URL")

	if len(uri) == 0 {
		uri = MongoDBUrl
	}

	mongo, err := mgo.ParseURL(uri)
	s, err := mgo.Dial(uri)
	if err != nil {
		fmt.Printf("Can't connect to mongo, go error %v\n", err)
		panic(err.Error())
	}
	s.SetSafe(&mgo.Safe{})
	fmt.Println("Connected to", uri)
	Session = s
	Mongo = mongo
}
func Connect() {
	uri := os.Getenv("MONGODB_URL")

	if len(uri) == 0 {
		uri = MongoDBUrl
	}

	mongo, err := mgo.ParseURL(uri)
	s, err := mgo.Dial(uri)
	if err != nil {
		fmt.Printf("Can't connect to mongo, go error %v\n", err)
		panic(err.Error())
	}
	s.SetSafe(&mgo.Safe{})
	fmt.Println("Connected to", uri)
	Session = s
	Mongo = mongo
}
func Connect ( ) { uri := os . Getenv ( " " ) if len ( uri ) == 0 { uri = MongoDBUrl } mongo , err := mgo . ParseURL ( uri ) s , err := mgo . Dial ( uri ) if err != nil { fmt . Printf ( " \n " , err ) panic ( err . Error ( ) ) } s . SetSafe ( & mgo . Safe { } ) fmt . Println ( " " , uri ) Session = s Mongo = mongo }
// Connect connects to mongodb
Connect connects to mongodb