Skip to content

Commit

Permalink
Added error message when MongoDB password is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
teoincontatto committed Jun 28, 2017
1 parent b3da9e8 commit 78d1a8f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion main/src/main/java/com/torodb/stampede/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.torodb.packaging.config.model.backend.derby.AbstractDerby;
import com.torodb.packaging.config.model.backend.postgres.AbstractPostgres;
import com.torodb.packaging.config.model.protocol.mongo.AbstractShardReplication;
import com.torodb.packaging.config.model.protocol.mongo.AuthMode;
import com.torodb.packaging.config.model.protocol.mongo.MongoPasswordConfig;
import com.torodb.packaging.config.util.BackendImplementationVisitor;
import com.torodb.packaging.config.util.BundleFactory;
Expand Down Expand Up @@ -220,7 +221,21 @@ public String getDatabase() {
+ "Please add following line to file " + postgres.getToropassFile() + ":\n"
+ postgres.getHost() + ":" + postgres.getPort() + ":"
+ postgres.getDatabase() + ":" + postgres.getUser() + ":<password>\n"
+ "Replace <password> for database user " + postgres.getUser() + "'s password");
+ "Replace <password> with the password of backend user " + postgres.getUser());
}
}

for (AbstractShardReplication shard : shards) {
if (shard.getAuth().getMode().value() != AuthMode.disabled
&& config.getReplication().getAuth().getPassword() == null) {
throw new SystemException("No password provided for database user "
+ shard.getAuth().getUser().value() + ".\n\n"
+ "Please add following line to file "
+ config.getReplication().getMongopassFile() + ":\n"
+ shard.getSyncSource().value() + ":" + shard.getAuth().getSource().value()
+ ":" + shard.getAuth().getUser().value() + ":<password>\n"
+ "Replace <password> with the password of mongodb user "
+ shard.getAuth().getUser().value());
}
}

Expand Down

0 comments on commit 78d1a8f

Please sign in to comment.