changed mongo URI to env variable

This commit is contained in:
Jonathan Barrow
2021-10-05 09:17:04 -04:00
parent 74eefb64c8
commit cefe5ecedb

View File

@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"log"
"os"
"time"
"github.com/PretendoNetwork/nex-go"
@@ -23,7 +24,7 @@ var mongoDatabase *mongo.Database
var mongoCollection *mongo.Collection
func connectMongo() {
mongoClient, _ = mongo.NewClient(options.Client().ApplyURI("mongodb://143.198.126.113:27017/"))
mongoClient, _ = mongo.NewClient(options.Client().ApplyURI(os.Getenv("MONGO_URI")))
mongoContext, _ = context.WithTimeout(context.Background(), 10*time.Second)
_ = mongoClient.Connect(mongoContext)