Update read database path
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Simon 2021-10-03 00:13:51 +01:00
parent 3e5bf1d23d
commit 90346cefda
1 changed files with 2 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package src
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"encoding/base64" "encoding/base64"
@ -20,7 +21,7 @@ var dbDevices *mongo.Collection
var mongoClient *mongo.Client var mongoClient *mongo.Client
func DbConnect() { func DbConnect() {
mongoClient, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri)) mongoClient, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(getMongoURI()))
if err != nil { if err != nil {
panic(err) panic(err)
@ -70,7 +71,6 @@ func DbDisconnect() {
} }
} }
func getMongoURI() string { func getMongoURI() string {
dbPath := os.Getenv("GIN_DB_PATH") dbPath := os.Getenv("GIN_DB_PATH")