Commit 5e61539f authored by Max Richter's avatar Max Richter
Browse files

Merge branch 'dev' of git.coco.study:fvitt/good2go into dev

parents 29e426ed d4c5b841
Pipeline #1816 failed with stages
in 58 seconds
......@@ -17,14 +17,10 @@ func CreateDBClient(timeout time.Duration) (client *mongo.Client, ctx context.Co
mongoURL := GetEnv("MONGO_URL", "mongodb://127.0.0.1:27017")
client, err := mongo.NewClient(options.Client().ApplyURI(mongoURL))
if err != nil {
log.Fatal(err)
}
ctx, cancel := CreateTimeoutCTX(timeout)
defer cancel()
err = client.Connect(ctx)
client, err := mongo.Connect(ctx, options.Client().ApplyURI(mongoURL))
if err != nil {
log.Fatal("[MONGODB] timeout ", err)
}
......@@ -34,7 +30,6 @@ func CreateDBClient(timeout time.Duration) (client *mongo.Client, ctx context.Co
if err != nil {
log.Fatal(err)
} else {
log.Println("[MONGODB] connected")
databases, err := client.ListDatabaseNames(ctx, bson.M{})
......
......@@ -2,28 +2,24 @@ version: "3"
services:
booking-service:
build: .
networks:
- db-network
depends_on:
- "mongo"
volumes:
- .:/app
working_dir: /app
ports:
- 8080:8080
environment:
MONGO_URL: ${MONGO_URL}
MONGO_DB: ${MONGO_DB}
mongo:
image: mongo:latest
container_name: mongo
networks:
- db-network
volumes:
- dbdata:/data/db
ports:
- 27017:27017
networks:
db-network:
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
MONGO_INITDB_DATABASE: ${MONGO_DB}
volumes:
dbdata:
MONGO_URL=mongodb://root:demo@mongo:27017
MONGO_DB=booking_service
MONGO_USERNAME=root
MONGO_PASSWORD=demo
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment