Read mongodb path from env
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Simon 2021-10-03 00:08:41 +01:00
parent 9bb6c12ef9
commit 3e5bf1d23d
3 changed files with 15 additions and 4 deletions

View File

@ -17,8 +17,8 @@ func main() {
}
func initializeRoutes(r *gin.Engine) {
r.POST("/data", src.CreateData)
r.PUT("/data/:id", src.CreateEnvironmentData)
//r.POST("/data", src.CreateData)
//r.PUT("/data/:id", src.CreateEnvironmentData)
r.Use(src.AEADHandler)
{
r.PUT("/data/authed/:id", src.CreateEnvironmentData)

View File

@ -13,7 +13,6 @@ import (
"golang.org/x/crypto/blake2s"
)
const uri = "mongodb://192.168.0.159:27017"
const salt = "ENVIRONMENT"
var dbCollection *mongo.Collection
@ -70,3 +69,14 @@ func DbDisconnect() {
panic(err)
}
}
func getMongoURI() string {
dbPath := os.Getenv("GIN_DB_PATH")
if dbPath == "" {
dbPath = "mongodb://192.168.0.159:27017"
}
return dbPath
}

View File

@ -8,7 +8,8 @@ services:
apiserver:
image: registry.jacknet.io/51m0n/environment-api:latest
environment:
- GIN_DB_PATH=mongodb://database:27017
proxy:
image: nginx:latest