Fix invalid local ip and aloow setting password in main.go
This commit is contained in:
parent
b3751856af
commit
5982888cb1
1 changed files with 5 additions and 3 deletions
|
@ -23,7 +23,8 @@ func initReplMongo() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// Create a new replica set client
|
// Create a new replica set client
|
||||||
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://sasha:12345@localhost:30000/?directConnection=true"))
|
uri := fmt.Sprintf("mongodb://%s:%s@localhost:30000/?directConnection=true", mongoInitdbRootUsername, mongoInitdbRootPassword)
|
||||||
|
client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +35,7 @@ func initReplMongo() {
|
||||||
for i := 0; i < numberOfContainers; i++ {
|
for i := 0; i < numberOfContainers; i++ {
|
||||||
members[i] = bson.M{
|
members[i] = bson.M{
|
||||||
"_id": i,
|
"_id": i,
|
||||||
"host": fmt.Sprintf("%s:%d", string(ips[0]), 30000+i),
|
"host": fmt.Sprintf("%s:%d", ips[0], 30000+i),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,8 @@ func initReplMongo() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// Create a new replica set client
|
// Create a new replica set client
|
||||||
client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://sasha:12345@localhost:30000/?directConnection=true"))
|
uri := fmt.Sprintf("mongodb://%s:%s@localhost:30000/?directConnection=true", mongoInitdbRootUsername, mongoInitdbRootPassword)
|
||||||
|
client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue