summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2017-03-15 00:56:47 +0100
committervarac <varacanero@zeromail.org>2017-03-15 19:22:50 +0100
commit8c1c4c102936dd779c74d615763e7adef7033ec1 (patch)
tree67ef14ec1748ce68bc9751d2fa0d2a1bf9baf7f1
parent5035b80537d4f6d4f4d57a3a429d12fc4ca04d54 (diff)
Direct connection when couch runs locally
-rw-r--r--lib/leap_cli/macros/stunnel.rb14
-rw-r--r--provider_base/services/mx.json1
-rw-r--r--provider_base/services/webapp.json1
-rw-r--r--puppet/modules/site_webapp/manifests/couchdb.pp2
4 files changed, 16 insertions, 2 deletions
diff --git a/lib/leap_cli/macros/stunnel.rb b/lib/leap_cli/macros/stunnel.rb
index 821bda38..59a38fad 100644
--- a/lib/leap_cli/macros/stunnel.rb
+++ b/lib/leap_cli/macros/stunnel.rb
@@ -87,6 +87,18 @@ module LeapCli
}
end
+ #
+ # what it the port of the couchdb we should connect to.
+ # host will always be localhost.
+ #
+ def couchdb_port
+ if services.include?('couchdb')
+ couch.port
+ else
+ stunnel.clients.couch_client.values.first.accept_port
+ end
+ end
+
private
#
@@ -103,4 +115,4 @@ module LeapCli
end
end
-end \ No newline at end of file
+end
diff --git a/provider_base/services/mx.json b/provider_base/services/mx.json
index 17861d18..480d7c6e 100644
--- a/provider_base/services/mx.json
+++ b/provider_base/services/mx.json
@@ -24,6 +24,7 @@
"password": "= secret :couch_leap_mx_password",
"salt": "= hex_secret :couch_leap_mx_password_salt, 128"
},
+ "couchdb_port": "= couchdb_port",
"mynetworks": "= host_ips(nodes)",
"rbls": ["zen.spamhaus.org"],
"clamav": {
diff --git a/provider_base/services/webapp.json b/provider_base/services/webapp.json
index 0fd62795..064d5b1a 100644
--- a/provider_base/services/webapp.json
+++ b/provider_base/services/webapp.json
@@ -11,6 +11,7 @@
"tickets", "vmail", "www-data"],
"domain": "= provider.domain",
"modules": ["user", "billing", "help"],
+ "couchdb_port": "= couchdb_port",
"couchdb_webapp_user": "= global.services[:couchdb].couch.users[:webapp]",
"couchdb_admin_user": "= global.services[:couchdb].couch.users[:admin]",
"customization_dir": "= file_path 'webapp'",
diff --git a/puppet/modules/site_webapp/manifests/couchdb.pp b/puppet/modules/site_webapp/manifests/couchdb.pp
index ffe364c6..e1947048 100644
--- a/puppet/modules/site_webapp/manifests/couchdb.pp
+++ b/puppet/modules/site_webapp/manifests/couchdb.pp
@@ -4,7 +4,7 @@ class site_webapp::couchdb {
$webapp = hiera('webapp')
# stunnel endpoint on port localhost:4000
$couchdb_host = 'localhost'
- $couchdb_port = '4000'
+ $couchdb_port = $webapp['couchdb_port']
$couchdb_webapp_user = $webapp['couchdb_webapp_user']['username']
$couchdb_webapp_password = $webapp['couchdb_webapp_user']['password']
$couchdb_admin_user = $webapp['couchdb_admin_user']['username']