Commit 6836d3dd authored by Daniel Gerhardt's avatar Daniel Gerhardt

Add support for CouchDB HTTP authentication

Authentication is needed if an CouchDB admin user exists for design doc
creation at startup.

Closes GH-6.
parent 85d2af23
......@@ -17,6 +17,8 @@ public class PersistanceConfig {
@Value("${couchdb.name}") private String couchDbName;
@Value("${couchdb.host}") private String couchDbHost;
@Value("${couchdb.port}") private int couchDbPort;
@Value("${couchdb.username:}") private String couchDbUsername;
@Value("${couchdb.password:}") private String couchDbPassword;
@Bean
public CouchDbConnector couchDbConnector() throws Exception {
......@@ -33,6 +35,10 @@ public class PersistanceConfig {
final HttpClientFactoryBean factory = new HttpClientFactoryBean();
factory.setHost(couchDbHost);
factory.setPort(couchDbPort);
if (!couchDbUsername.isEmpty()) {
factory.setUsername(couchDbUsername);
factory.setPassword(couchDbPassword);
}
return factory;
}
......
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