Update read database path
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
3e5bf1d23d
commit
90346cefda
|
@ -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")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue