Skip to content

Commit

Permalink
Merge pull request #67 from usdot-jpo-ode/mongo-security
Browse files Browse the repository at this point in the history
Mongo security
  • Loading branch information
John-Wiens authored Feb 27, 2024
2 parents 3775ef1 + 17b4716 commit 7b22f41
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 54 deletions.
2 changes: 1 addition & 1 deletion jpo-conflictmonitor
Submodule jpo-conflictmonitor updated from 30c308 to 644f45
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class MongoConfig extends AbstractMongoClientConfiguration{
@Value("${spring.data.mongodb.port}")
private String port;

@Value("${spring.data.mongodb.username}")
private String username;

@Value("${spring.data.mongodb.password}")
private String password;

@Override
protected String getDatabaseName() {
return db;
Expand All @@ -42,7 +48,8 @@ protected String getDatabaseName() {
@Override
public void configureClientSettings(MongoClientSettings.Builder builder) {
// customization hook
String uri = "mongodb://"+host+":"+port+"/"+db;
String uri = "mongodb://"+username+":"+password+"@"+host+":"+port+"/"+db;
// String uri = "mongodb://"+host+":"+port+"/"+db;
System.out.println("Connecting to MongoDB at: " + uri);
builder.applyConnectionString(new ConnectionString(uri));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ server.port=8081
spring.data.mongodb.database=ConflictMonitor
spring.data.mongodb.host=${DOCKER_HOST_IP:localhost}
spring.data.mongodb.port=27017
spring.data.mongodb.username=${CM_MONGO_API_USERNAME:api}
spring.data.mongodb.password=${CM_MONGO_API_PASSWORD:api}

cmServerURL = ${CM_SERVER_URL:http://localhost:8082}
mongoTimeoutMs = ${CM_MONGO_TIMEOUT_MS:5000}
Expand Down

This file was deleted.

0 comments on commit 7b22f41

Please sign in to comment.